mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-02-23 11:21:12 +00:00
live-build/functions: Always use mount --make-private before umount
Util-linux 2.33 fixed mount --rbind --make-rslave which did not pass MS_REC with MS_BIND and livecd-rootfs did only --bind --make-rslave effectively with prior mount versions. While mount --rbind --rslave are properly passed the flags to mount() unmounting did not work cleanly with --make-rslave. To clearly stop propagation of umount, --make-private is used instead of --make-rslave and it is always set before umounts. Umount -R is replaced with a simple umount since submounts are tore down in teardown_mountpoint() earlier. LP: #1813730
This commit is contained in:
parent
a06d208871
commit
33c5ad0b19
@ -91,7 +91,7 @@ mount_image() {
|
||||
setup_mountpoint() {
|
||||
local mountpoint="$1"
|
||||
|
||||
mount --rbind --make-rslave /dev "$mountpoint/dev"
|
||||
mount --rbind /dev "$mountpoint/dev"
|
||||
mount proc-live -t proc "$mountpoint/proc"
|
||||
mount sysfs-live -t sysfs "$mountpoint/sys"
|
||||
mount -t tmpfs none "$mountpoint/tmp"
|
||||
@ -112,6 +112,7 @@ teardown_mountpoint() {
|
||||
# sort -r ensures that deeper mountpoints are unmounted first
|
||||
for submount in $(awk </proc/self/mounts "\$2 ~ /$mountpoint_match/ \
|
||||
{ print \$2 }" | LC_ALL=C sort -r); do
|
||||
mount --make-private $submount
|
||||
umount $submount
|
||||
done
|
||||
mv resolv.conf.tmp "$mountpoint/etc/resolv.conf"
|
||||
@ -179,7 +180,8 @@ EOF
|
||||
umount_partition() {
|
||||
local mountpoint=${1}
|
||||
teardown_mountpoint $mountpoint
|
||||
umount -R $mountpoint
|
||||
mount --make-private $mountpoint
|
||||
umount $mountpoint
|
||||
udevadm settle
|
||||
|
||||
if [ -n "${rootfs_dev_mapper}" -a -b "${rootfs_dev_mapper}" ]; then
|
||||
@ -202,6 +204,7 @@ umount_disk_image() {
|
||||
# zero fill free space in UEFI partition
|
||||
cat < /dev/zero > "$mountpoint/boot/efi/bloat_file" 2> /dev/null || true
|
||||
rm "$mountpoint/boot/efi/bloat_file"
|
||||
mount --make-private "$mountpoint/boot/efi"
|
||||
umount --detach-loop "$mountpoint/boot/efi"
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user