Whamcloud - gitweb
land lustre part of b_hd_sec on HEAD.
[fs/lustre-release.git] / lustre / tests / llmountcleanup.sh
1 #!/bin/sh
2
3 export PATH=`dirname $0`/../utils:$PATH
4
5 LCONF=${LCONF:-lconf}
6 NAME=${NAME:-local}
7 TMP=${TMP:-/tmp}
8
9 config=$NAME.xml
10 mkconfig=$NAME.sh
11
12 . krb5_env.sh
13
14 if [ "$PORTALS" ]; then
15   portals_opt="--portals=$PORTALS"
16 fi
17
18 if [ "$LUSTRE" ]; then
19   lustre_opt="--lustre=$LUSTRE"
20 fi
21
22 if [ "$LDAPURL" ]; then
23     conf_opt="--ldapurl $LDAPURL --config $NAME"
24 else
25     if [ ! -f $config ]; then
26         sh $mkconfig $config || exit 1
27     fi
28     conf_opt="$config"
29 fi    
30
31 [ "$NODE" ] && node_opt="--node $NODE"
32
33 sync; sleep 2; sync
34
35 [ "$MOUNT2" ] && umount $MOUNT2
36
37 ${LCONF} $NOMOD $portals_opt $lustre_opt $node_opt --cleanup $@ \
38     --dump $TMP/debug $conf_opt
39 rc=$?
40 echo "lconf DONE"
41 stop_lsvcgssd
42 stop_lgssd
43
44 BUSY=`dmesg | grep -i destruct`
45 if [ "$BUSY" ]; then
46         echo "$BUSY" 1>&2
47         mv $TMP/debug $TMP/debug-busy.`date +%s`
48         exit 255
49 fi
50 LEAK_LUSTRE=`dmesg | tail -n 30 | grep "obd mem.*leaked"`
51 LEAK_PORTALS=`dmesg | tail -n 20 | grep "Portals memory leaked"`
52 if [ "$LEAK_LUSTRE" -o "$LEAK_PORTALS" ]; then
53         echo "$LEAK_LUSTRE" 1>&2
54         echo "$LEAK_PORTALS" 1>&2
55         mv $TMP/debug $TMP/debug-leak.`date +%s`
56         exit 254
57 fi
58 lsmod | grep portals && echo "modules still loaded" && exit 1
59
60 exit $rc