Browse Source

rootfs: Use separate mounts lock file

We couldn't identify any resource sharing in any combination of
buildchroot and rootfses, so a separate lock has been recently
introduced in e438c8f6 "rootfs: Unmount rootfs mounts if not needed".

This didn't work correctly: MOUNTS_LOCKFILE value inside rootfs.bbclass
is overwritten by buildchroot.bbclass inherited later.

rootfs_do_mounts and buildchroot_do_mounts would only need to be
serialized if mount(8) would have unlocked shared resources. At least a
simple script running 100 mounts and umounts in parallel didn't reveal
any issues.

Use a different lock file.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
Anton Mikanovich 4 years ago
parent
commit
5e563ac4b7
1 changed files with 3 additions and 3 deletions
  1. 3 3
      meta/classes/rootfs.bbclass

+ 3 - 3
meta/classes/rootfs.bbclass

@@ -26,7 +26,7 @@ export LANG = "C"
 export LANGUAGE = "C"
 export LANGUAGE = "C"
 export LC_ALL = "C"
 export LC_ALL = "C"
 
 
-MOUNT_LOCKFILE = "${ROOTFSDIR}.lock"
+IMAGE_MOUNT_LOCKFILE = "${ROOTFSDIR}.lock"
 
 
 rootfs_do_mounts[weight] = "3"
 rootfs_do_mounts[weight] = "3"
 rootfs_do_mounts() {
 rootfs_do_mounts() {
@@ -70,7 +70,7 @@ rootfs_do_mounts() {
                 mount --bind '${REPO_BASE_DIR}' '${ROOTFSDIR}/base-apt'
                 mount --bind '${REPO_BASE_DIR}' '${ROOTFSDIR}/base-apt'
         fi
         fi
 
 
-        ) 9>'${MOUNT_LOCKFILE}'
+        ) 9>'${IMAGE_MOUNT_LOCKFILE}'
 EOSUDO
 EOSUDO
 }
 }
 
 
@@ -103,7 +103,7 @@ rootfs_undo_mounts() {
             umount -R ${ROOTFSDIR}/proc
             umount -R ${ROOTFSDIR}/proc
         mountpoint -q '${ROOTFSDIR}/dev' && \
         mountpoint -q '${ROOTFSDIR}/dev' && \
             umount -R ${ROOTFSDIR}/dev
             umount -R ${ROOTFSDIR}/dev
-        ) 9>'${MOUNT_LOCKFILE}'
+        ) 9>'${IMAGE_MOUNT_LOCKFILE}'
 EOSUDO
 EOSUDO
 }
 }