Send SIGKILL after 2 failed SIGTERM when unmounting.

This commit is contained in:
Roy Marples 2010-03-16 21:34:48 +00:00
parent 59b08643f1
commit 4b333eaf36

View File

@ -36,7 +36,7 @@ do_unmount()
;; ;;
esac 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 while ! LC_ALL=C $cmd "$mnt" 2>/dev/null; do
if type fuser >/dev/null 2>&1; then if type fuser >/dev/null 2>&1; then
pids="$(fuser $f_opts "$mnt" 2>/dev/null)" pids="$(fuser $f_opts "$mnt" 2>/dev/null)"
@ -53,13 +53,16 @@ do_unmount()
eend 1 "in use but fuser finds nothing" eend 1 "in use but fuser finds nothing"
retry=0;; retry=0;;
*) *)
local sig="KILL" if [ $retry -le 0 ]; then
[ $retry -gt 0 ] && sig="TERM" eend 1
else
local sig="TERM"
retry=$(($retry - 1))
[ $retry = 1 ] && sig="KILL"
fuser $f_kill$sig -k $f_opts \ fuser $f_kill$sig -k $f_opts \
"$mnt" >/dev/null 2>&1 "$mnt" >/dev/null 2>&1
sleep 1 sleep 1
retry=$(($retry - 1)) fi
[ $retry -le 0 ] && eend 1
;; ;;
esac esac
[ $retry -le 0 ] && break [ $retry -le 0 ] && break