aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2010-03-16 21:34:48 +0000
committerRoy Marples <roy@marples.name>2010-03-16 21:34:48 +0000
commit4b333eaf366b6168fbe3e0e2cbf05022499c79aa (patch)
tree489b24ff4beeaa4d0490d046373778dd695b284b
parent59b08643f1eb833ff54b62af782d5e72d83d61b4 (diff)
Send SIGKILL after 2 failed SIGTERM when unmounting.
-rw-r--r--sh/rc-mount.sh19
1 files changed, 11 insertions, 8 deletions
diff --git a/sh/rc-mount.sh b/sh/rc-mount.sh
index 3b80c8c9..940e5e5f 100644
--- a/sh/rc-mount.sh
+++ b/sh/rc-mount.sh
@@ -36,7 +36,7 @@ do_unmount()
;;
esac
- retry=3
+ retry=4 # Effectively TERM, sleep 1, TERM, sleep 1, KILL, sleep 1
while ! LC_ALL=C $cmd "$mnt" 2>/dev/null; do
if type fuser >/dev/null 2>&1; then
pids="$(fuser $f_opts "$mnt" 2>/dev/null)"
@@ -53,13 +53,16 @@ do_unmount()
eend 1 "in use but fuser finds nothing"
retry=0;;
*)
- local sig="KILL"
- [ $retry -gt 0 ] && sig="TERM"
- fuser $f_kill$sig -k $f_opts \
- "$mnt" >/dev/null 2>&1
- sleep 1
- retry=$(($retry - 1))
- [ $retry -le 0 ] && eend 1
+ if [ $retry -le 0 ]; then
+ eend 1
+ else
+ local sig="TERM"
+ retry=$(($retry - 1))
+ [ $retry = 1 ] && sig="KILL"
+ fuser $f_kill$sig -k $f_opts \
+ "$mnt" >/dev/null 2>&1
+ sleep 1
+ fi
;;
esac
[ $retry -le 0 ] && break