[openwrt/openwrt] base-files: upgrade: try umount lvm and loop devices

LEDE Commits lede-commits at lists.infradead.org
Wed Aug 4 11:13:14 PDT 2021


dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/e67865c569c0cbdc452c63b54b02f5c3cc4d247a

commit e67865c569c0cbdc452c63b54b02f5c3cc4d247a
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Wed Aug 4 19:03:16 2021 +0100

    base-files: upgrade: try umount lvm and loop devices
    
    Try umount on device mapper and loop devices still mounted, so the
    subsequent call to disactivate all physical volumes and delete all
    loop devices is more likely to succeed.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 package/base-files/files/lib/upgrade/stage2 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2
index 30ad19f7f1..45fb98d889 100755
--- a/package/base-files/files/lib/upgrade/stage2
+++ b/package/base-files/files/lib/upgrade/stage2
@@ -64,6 +64,10 @@ switch_to_ramfs() {
 	/bin/mount -o remount,ro /mnt
 	/bin/umount -l /mnt
 
+	grep -e "^/dev/dm-.*" -e "^/dev/loop.*" /proc/mounts | while read bdev mp _r; do
+		umount $mp
+	done
+
 	[ "$RAMFS_COPY_LOSETUP" ] && losetup -D
 	[ "$RAMFS_COPY_LVM" ] && {
 		mkdir -p /tmp/lvm/cache



More information about the lede-commits mailing list