[OpenWrt-Devel] [PATCH 1/3] build: install-dtb: fix race condition when copying dtb
Yousong Zhou
yszhou4tech at gmail.com
Thu Sep 12 21:08:13 EDT 2019
Currently for at91 target, Build/install-dtb can be triggered concurrently for
multiple different TARGET_FILESYSTEMS, cp command can fail when the
target file is already open exclusively by other cp process
[ -f /builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/at91sam9263ek-uImage -a -f /builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/root.ubifs+fs=-m_2048_-e_126KiB_-c_2048+pkg=68b329da ]
[ -f /builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/at91sam9263ek-uImage -a -f /builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/root.ext4+pkg=68b329da ]
cp -fpR /builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/linux-4.14.141/arch/arm/boot/dts/at91sam9263ek.dtb /builder/shared-workdir/build/bin/targets/at91/sam9x/openwrt-at91-sam9x-at91sam9263ek.dtb;
cp -fpR /builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/linux-4.14.141/arch/arm/boot/dts/at91sam9263ek.dtb /builder/shared-workdir/build/bin/targets/at91/sam9x/openwrt-at91-sam9x-at91sam9263ek.dtb;
cp: cannot create regular file '/builder/shared-workdir/build/bin/targets/at91/sam9x/openwrt-at91-sam9x-at91sam9263ek.dtb': File exists
Makefile:87: recipe for target '/builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/tmp/openwrt-at91-sam9x-at91sam9263ek-ubifs-dtb' failed
make[4]: *** [/builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/tmp/openwrt-at91-sam9x-at91sam9263ek-ubifs-dtb] Error 1
Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
include/image-commands.mk | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/image-commands.mk b/include/image-commands.mk
index 89c17aec5b..1d0aed1918 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -136,10 +136,13 @@ define Build/append-dtb
endef
define Build/install-dtb
- $(foreach dts,$(DEVICE_DTS), \
- $(CP) \
- $(DTS_DIR)/$(dts).dtb \
- $(BIN_DIR)/$(IMG_PREFIX)-$(dts).dtb; \
+ $(call locked, \
+ $(foreach dts,$(DEVICE_DTS), \
+ $(CP) \
+ $(DTS_DIR)/$(dts).dtb \
+ $(BIN_DIR)/$(IMG_PREFIX)-$(dts).dtb; \
+ ), \
+ install-dtb-$(IMG_PREFIX) \
)
endef
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list