diff options
author | Bill Nottingham <notting@redhat.com> | 2001-02-13 18:47:29 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2001-02-13 18:47:29 +0000 |
commit | 2f00a9ad2814616d67c644a56c62543fc978956d (patch) | |
tree | 829520383110d5b585b92d6d95ee35f93ce2bfa1 | |
parent | f31283a24485e93ddebbabe3f30725a565f85e81 (diff) | |
download | initscripts-2f00a9ad2814616d67c644a56c62543fc978956d.tar initscripts-2f00a9ad2814616d67c644a56c62543fc978956d.tar.gz initscripts-2f00a9ad2814616d67c644a56c62543fc978956d.tar.bz2 initscripts-2f00a9ad2814616d67c644a56c62543fc978956d.tar.xz initscripts-2f00a9ad2814616d67c644a56c62543fc978956d.zip |
unmount loopback stuff before stopping netfs or shutting down
-rwxr-xr-x | rc.d/init.d/halt | 21 | ||||
-rwxr-xr-x | rc.d/init.d/netfs | 20 |
2 files changed, 41 insertions, 0 deletions
diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt index b5a626b0..b98ac775 100755 --- a/rc.d/init.d/halt +++ b/rc.d/init.d/halt @@ -121,6 +121,27 @@ SWAPS=`awk '! /^Filename/ { print $1 }' /proc/swaps` [ -x /sbin/quotaoff ] && runcmd $"Turning off quotas: " /sbin/quotaoff -a # Unmount file systems, killing processes if we have to. +# Unmount loopback stuff first +remaining=`awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts` +[ -n "$remaining" ] && { + sig= + retry=3 + while [ -n "$remaining" -a "$retry" -gt 0 ] + do + if [ "$retry" -lt 3 ]; then + runcmd $"Unmounting loopback filesystems (retry):" umount $remaining + else + runcmd $"Unmounting loobpack filesystems: " umount $remaining + fi + remaining=`awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts` + [ -z "$remaining" && break + /sbin/fuser -k -m $sig $remaining >/dev/null + sleep 5 + retry=$(($retry -1)) + sig=-9 + done +} + sig= retry=3 remaining=`awk '!/(^#|proc|loopfs|autofs|^none|^\/dev\/root| \/ )/ {print $2}' /proc/mounts` diff --git a/rc.d/init.d/netfs b/rc.d/init.d/netfs index 82e2547e..753937f3 100755 --- a/rc.d/init.d/netfs +++ b/rc.d/init.d/netfs @@ -43,6 +43,26 @@ case "$1" in action $"Mounting other filesystems: " mount -a -t nonfs,smbfs,ncpfs ;; stop) + # Unmount loopback stuff first + remaining=`awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts` + [ -n "$remaining" ] && { + sig= + retry=3 + while [ -n "$remaining" -a "$retry" -gt 0 ] + do + if [ "$retry" -lt 3 ]; then + action $"Unmounting loopback filesystems (retry):" umount $remaining + else + action $"Unmounting loobpack filesystems: " umount $remaining + fi + remaining=`awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts` + [ -z "$remaining" && break + /sbin/fuser -k -m $sig $remaining >/dev/null + sleep 5 + retry=$(($retry -1)) + sig=-9 + done + } [ -n "$NFSMTAB" ] && { sig= retry=3 |