Skip to contentSkip to conversation

kernel.bbclass: Fix race condition

PATCH New Ed Bartosh 1 participant 1 message Mar 12, 2015

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

PATCH 1/1 kernel.bbclass: Fix race condition

Race condition between do_compile_kernelmodules and do_shared_workdir tasks occurs when do_compilemodules changes files in include/generated/* while do_shared_workdir tries to copy them to shared working directory.

Functionality of do_shared_workdir has been moved to separate function mk_shared_workdir and called from do_kernel_compile. do_shared_workdir left in the code as it may be used in many recipes.

[YOCTO #7321]

---
 meta/classes/kernel.bbclass | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
meta/classes/kernel.bbclass +11 -1
index 125ed88..aad430a 100644
@@ -231,6 +231,8 @@ kernel_do_install() {
 	[ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/boot/Module.symvers-${KERNEL_VERSION}
 	install -d ${D}${sysconfdir}/modules-load.d
 	install -d ${D}${sysconfdir}/modprobe.d
+
+	mk_shared_workdir
 }
 do_install[prefuncs] += "package_get_auto_pr"
 
@@ -245,7 +247,7 @@ emit_depmod_pkgdata() {
 
 PACKAGEFUNCS += "emit_depmod_pkgdata"
 
-do_shared_workdir () {
+mk_shared_workdir () {
 	cd ${B}
 
 	kerneldir=${STAGING_KERNEL_BUILDDIR}
@@ -289,6 +291,14 @@ do_shared_workdir () {
 	fi
 }
 
+# NOTE!!! Functionality of do_shared_workdir has been moved to mk_shared_workdir
+# and called from kernel_do_compile.
+# It caused race condition with do_compile_kernelmodules when it runs
+# in parallel with do_compile_kernelmodules
+do_shared_workdir () {
+	:
+}
+
 # We don't need to stage anything, not the modules/firmware since those would clash with linux-firmware
 sysroot_stage_all () {
 	:
Signature · 1 line
2.1.4