From 9e0adb7706d937a19442f4d697f2204750330cff Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 7 Aug 2001 07:04:12 +0000 Subject: detach loopback devices at shutdown (#43919, #45826) --- rc.d/init.d/netfs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'rc.d/init.d/netfs') diff --git a/rc.d/init.d/netfs b/rc.d/init.d/netfs index 4ffed775..4a6a215f 100755 --- a/rc.d/init.d/netfs +++ b/rc.d/init.d/netfs @@ -45,7 +45,7 @@ case "$1" in ;; stop) # Unmount loopback stuff first - remaining=`awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts` + remaining=`awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $1}' /proc/mounts` [ -n "$remaining" ] && { sig= retry=3 @@ -56,6 +56,10 @@ case "$1" in else action $"Unmounting loopback filesystems: " umount $remaining fi + for dev in $remaining ; do + losetup $dev >/dev/null 2>&1 && \ + action $"Detaching loopback device $dev: " losetup -d $dev + done remaining=`awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts` [ -z "$remaining" ] && break /sbin/fuser -k -m $sig $remaining >/dev/null -- cgit v1.2.1