From 4b333eaf366b6168fbe3e0e2cbf05022499c79aa Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 16 Mar 2010 21:34:48 +0000 Subject: Send SIGKILL after 2 failed SIGTERM when unmounting. --- sh/rc-mount.sh | 19 +++++++++++-------- 1 file 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 -- cgit v1.2.3