Whamcloud - gitweb
land 0.5.20.3 b_devel onto HEAD (b_devel will remain)
[fs/lustre-release.git] / lustre / tests / llmountcleanup.sh
index b9ce682..cd28d21 100755 (executable)
@@ -1,67 +1,40 @@
 #!/bin/sh
 
-SRCDIR="`dirname $0`"
-. $SRCDIR/common.sh
+LCONF=${LCONF:-../utils/lconf}
+NAME=${NAME:-local}
+TMP=${TMP:-/tmp}
 
-$DBGCTL get_debug > /tmp/debug.1
+config=$NAME.xml
+mkconfig=$NAME.sh
 
-if [ "`mount | grep '/mnt/lustre'`" ]; then
-       umount /mnt/lustre || fail "cannot unmount"
+if [ "$PORTALS" ]; then
+  portals_opt="--portals=$PORTALS"
 fi
 
-killall acceptor
-rmmod llite
-rmmod mdc
-
-$OBDCTL <<EOF
-name2dev OSCDEV
-cleanup
-detach
-name2dev LDLMDEV
-cleanup
-detach
-name2dev RPCDEV
-cleanup
-detach
-name2dev OSTDEV
-cleanup
-detach
-name2dev OBDDEV
-cleanup
-detach
-name2dev MDSDEV
-cleanup
-detach
-quit
-EOF
-
-rmmod obdecho
-rmmod mds
-rmmod osc
-rmmod ost
-rmmod obdfilter
-rmmod obdext2
-rmmod ldlm
-rmmod ptlrpc
-rmmod obdclass
-
-$DBGCTL get_debug > /tmp/debug.2
+if [ "$LUSTRE" ]; then
+  lustre_opt="--lustre=$LUSTRE"
+fi
 
-$PTLCTL <<EOF
-setup tcp
-disconnect
-del_uuid self
-del_uuid mds
-del_uuid ost
-del_uuid ldlm
-quit
-EOF
+if [ ! -f $config ]; then
+   sh $mkconfig $config || exit 1
+fi
 
-rmmod kqswnal
-rmmod ksocknal
-rmmod portals
+sync; sleep 2; sync
+${LCONF} $portals_opt $lustre_opt --cleanup --dump $TMP/debug $config
+rc=$?
+BUSY=`dmesg | grep -i destruct`
+if [ "$BUSY" ]; then
+       echo "$BUSY" 1>&2
+       mv $TMP/debug $TMP/debug-busy.`date +%s`
+       exit 255
+fi
+LEAK_LUSTRE=`dmesg | tail -20 | grep -v "leaked: 0" | grep leaked`
+LEAK_PORTALS=`dmesg | tail -20 | grep "Portals memory leaked"`
+if [ "$LEAK_LUSTRE" -o "$LEAK_PORTALS" ]; then
+       echo "$LEAK_LUSTRE" 1>&2
+       echo "$LEAK_PORTALS" 1>&2
+       mv $TMP/debug $TMP/debug-leak.`date +%s`
+       exit 254
+fi
 
-losetup -d ${LOOP}0
-losetup -d ${LOOP}1
-losetup -d ${LOOP}2
-exit 0
+exit $rc