uvol: call umount instead of using 'block umount'
authorDaniel Golle <daniel@makrotopia.org>
Sun, 13 Feb 2022 21:30:13 +0000 (21:30 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Sun, 13 Feb 2022 22:30:42 +0000 (22:30 +0000)
Calling 'block umount' results in *all* devices listed in
/etc/config/fstab being unmounted.
Just call 'umount /dev/$devname' directly instead as that has the
desired effect.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
utils/uvol/files/lvm.sh
utils/uvol/files/ubi.sh

index 0639c10f1b42570fc7f2ca0fd9adbf1224e9e12c..c7e93f13f29971db4f811794aabe4c6004d8147a 100644 (file)
@@ -202,7 +202,7 @@ disactivatevol() {
                *)
                        [ "$lv_active" = "active" ] || return 0
                        devname="$(getdev "$1")"
-                       [ "$devname" ] && /sbin/block umount "$devname"
+                       [ "$devname" ] && umount "/dev/$devname"
                        lvm_cmd lvchange -a n "$lv_full_name"
                        lvm_cmd lvchange -k y "$lv_full_name" || return $?
                        return 0
index d7593606fce0c63da0fcd1cca745575b61014ce9..7637fba6825520e7a52c4bc6e7a34bd92659fe06 100644 (file)
@@ -168,12 +168,12 @@ disactivatevol() {
        vol_is_mode "$voldev" wo && return 22
        vol_is_mode "$voldev" wp && return 16
        if vol_is_mode "$voldev" ro; then
-               /sbin/block umount "ubiblock${voldev:3}"
+               grep -q "^/dev/ubiblock${voldev:3}" /proc/self/mounts && umount "/dev/ubiblock${voldev:3}"
                ubiblock --remove "/dev/$voldev"
                ubirename "/dev/$ubidev" "uvol-ro-$1" "uvol-rd-$1" || return $?
                return 0
        elif vol_is_mode "$voldev" rw; then
-               /sbin/block umount "$voldev"
+               umount "/dev/$voldev"
                ubirename "/dev/$ubidev" "uvol-rw-$1" "uvol-wd-$1" || return $?
                block_hotplug remove "$voldev"
                return 0