Whamcloud - gitweb
- changes in cmobd.sh - there should not be cache LMV
[fs/lustre-release.git] / lustre / tests / llmountcleanup.sh
index 81a5832..ea054ee 100755 (executable)
@@ -1,45 +1,60 @@
 #!/bin/sh
-LOOP0=/dev/loop0
-LOOP1=/dev/loop1
 
-if [ ! -e $LOOP0 ]; then
-    echo $LOOP0 'doesnt exist: (not) using devfs?' 
-    exit
+export PATH=`dirname $0`/../utils:$PATH
+
+LCONF=${LCONF:-lconf}
+NAME=${NAME:-local}
+TMP=${TMP:-/tmp}
+
+config=$NAME.xml
+mkconfig=$NAME.sh
+
+. krb5_env.sh
+
+if [ "$PORTALS" ]; then
+  portals_opt="--portals=$PORTALS"
+fi
+
+if [ "$LUSTRE" ]; then
+  lustre_opt="--lustre=$LUSTRE"
+fi
+
+if [ "$LDAPURL" ]; then
+    conf_opt="--ldapurl $LDAPURL --config $NAME"
+else
+    if [ ! -f $config ]; then
+       sh $mkconfig $config || exit 1
+    fi
+    conf_opt="$config"
+fi    
+
+[ "$NODE" ] && node_opt="--node $NODE"
+
+sync; sleep 2; sync
+
+[ "$MOUNT2" ] && umount $MOUNT2
+
+${LCONF} $NOMOD $portals_opt $lustre_opt $node_opt --cleanup $@ \
+    --dump $TMP/debug $conf_opt
+rc=$?
+echo "lconf DONE"
+stop_lsvcgssd
+stop_lgssd
+
+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 -n 30 | grep "obd mem.*leaked"`
+LEAK_PORTALS=`dmesg | tail -n 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
+lsmod | grep portals && echo "modules still loaded" && exit 1
 
-umount /mnt/obd
-
-rmmod llight
-rmmod mdc
-/usr/src/obd/utils/obdctl <<EOF
-device 3
-cleanup
-detach
-device 2
-cleanup
-detach
-device 1
-cleanup
-detach
-device 0
-cleanup
-detach
-quit
-EOF
-rmmod mds
-rmmod osc
-rmmod ost
-rmmod obdext2
-rmmod obdclass
-rmmod ptlrpc
-/usr/src/portals/linux/utils/ptlctl <<EOF
-setup tcp localhost 1234
-disconnect self
-disconnect mds
-EOF
-rmmod ksocknal
-killall acceptor
-rmmod portals
-
-losetup -d $LOOP0
-losetup -d $LOOP1
\ No newline at end of file
+exit $rc