From: grev Date: Tue, 23 Dec 2008 13:07:36 +0000 (+0000) Subject: b=17589 X-Git-Tag: v1_8_0_110~365 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=6f698780af7ed3f41b3c2c636f7bc5f06f14acbb;p=fs%2Flustre-release.git b=17589 i=Nathan.Rutman i=Robert.Read zconf_umount_client{s} fix: kill ps-s before force umount --- diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index c5bf857..25d90a4 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -380,12 +380,27 @@ zconf_mount() { zconf_umount() { local client=$1 local mnt=$2 + local force + local busy + local need_kill + [ "$3" ] && force=-f local running=$(do_node $client "grep -c $mnt' ' /proc/mounts") || true if [ $running -ne 0 ]; then echo "Stopping client $client $mnt (opts:$force)" - do_node $client lsof | grep "$mnt" || true - do_node $client umount $force $mnt + do_node $client lsof -t $mnt || need_kill=no + if [ "x$force" != "x" -a "x$need_kill" != "xno" ]; then + pids=$(do_node $client lsof -t $mnt | sort -u); + if [ -n $pids ]; then + do_node $client kill -9 $pids || true + fi + fi + + busy=$(do_node $client "umount $force $mnt 2>&1" | grep -c "busy") || true + if [ $busy -ne 0 ] ; then + echo "$mnt is still busy, wait one second" && sleep 1 + do_node $client umount $force $mnt + fi fi } @@ -421,10 +436,27 @@ zconf_mount_clients() { zconf_umount_clients() { local clients=$1 local mnt=$2 + local force + [ "$3" ] && force=-f echo "Stopping clients: $clients $mnt (opts:$force)" - do_nodes $clients umount $force $mnt + do_nodes $clients "set -x; running=\\\$(grep -c $mnt' ' /proc/mounts) +if [ \\\$running -ne 0 ] ; then +echo Stopping client \\\$(hostname) client $mnt opts:$force +lsof -t $mnt || need_kill=no +if [ "x$force" != "x" -a "x\\\$need_kill" != "xno" ]; then + pids=\\\$(lsof -t $mnt | sort -u); + if [ -n \\\$pids ]; then + kill -9 \\\$pids + fi +fi +busy=\\\$(umount $force $mnt 2>&1 | grep -c "busy") +if [ \\\$busy -ne 0 ] ; then + echo "$mnt is still busy, wait one second" && sleep 1 + umount $force $mnt +fi +fi" } shutdown_facet() {