From ccdd2aa4d6a1d798e6cd4d53ed38d34cd4dc0743 Mon Sep 17 00:00:00 2001 From: Jaromil Date: Sun, 15 May 2011 20:03:11 +0200 Subject: [PATCH] fixed slam for a single tomb still need to debug "tomb slam all" --- src/tomb | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/tomb b/src/tomb index 9922e36..e9beae4 100755 --- a/src/tomb +++ b/src/tomb @@ -777,10 +777,17 @@ umount_tomb() { if [ $SLAM ]; then notice "Slamming tomb $tombname mounted on $tombmount" act "Kill all processes busy inside the tomb" + pidk=`lsof -t "$tombmount"` + for p in "$pidk"; do + pname=`pidof $p` + func "killing PID $p of $pname..." + kill -9 $p + done else notice "Closing tomb $tombname mounted on $tombmount" fi - # check if there are binded dirs and close them first + + # check if there are binded dirs and close them tombmount_esc=`sed 's:\/:\\\/:g' <<< $tombmount ` unbind=`mount | awk "/^$tombmount_esc.*bind/"' { print $3 }'` for b in ${(f)unbind}; do @@ -814,19 +821,6 @@ umount_tomb() { umount ${tombmount} 2> /dev/null if ! [ $? = 0 ]; then error "Tomb is busy, cannot umount!" - if [ $SLAM ]; then - notice "Slamming tomb killing all processes using it" - pidk=`lsof -t "$tombmount"` - for p in "$pidk"; do - pname=`pidof $p` - func "killing PID $p of $pname..." - kill -9 $p - done - umount "${tombmount}" - else - error "Cannot umount $tombname on $tombmount" - return 1 - fi fi fi