udev-block-add-change: better mount status check
The canonical device name is not necessarily used in /proc/mounts or /proc/self/mountinfo, see /dev/dm-0 vs. /dev/mapper/dmroot. (And only checking by major:minor is not possible in the case of btrfs.) Also fixes another bug where e.g. dm-10 would match when really only dm-1 was mounted, or when the mountpoint path included the device name, etc. Also catches enabled swap.
This commit is contained in:
parent
281c628b0e
commit
e7d7111f13
@ -20,8 +20,8 @@ xs_remove() {
|
|||||||
|
|
||||||
is_used() {
|
is_used() {
|
||||||
local sys_devpath=$1
|
local sys_devpath=$1
|
||||||
# mounted
|
# mounted; or enabled swap
|
||||||
if fgrep -q $(basename $sys_devpath) /proc/mounts; then
|
if lsblk -dnr -o MOUNTPOINT "$DEVNAME" | grep -q .; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
# part of other device-mapper
|
# part of other device-mapper
|
||||||
|
Loading…
Reference in New Issue
Block a user