Whamcloud - gitweb
- landing of b_hd_cleanup_merge to 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 if [ "$PORTALS" ]; then
13   portals_opt="--portals=$PORTALS"
14 fi
15
16 if [ "$LUSTRE" ]; then
17   lustre_opt="--lustre=$LUSTRE"
18 fi
19
20 if [ "$LDAPURL" ]; then
21     conf_opt="--ldapurl $LDAPURL --config $NAME"
22 else
23     if [ ! -f $config ]; then
24         sh $mkconfig $config || exit 1
25     fi
26     conf_opt="$config"
27 fi    
28
29 [ "$NODE" ] && node_opt="--node $NODE"
30
31 sync; sleep 2; sync
32
33 [ "$MOUNT2" ] && umount $MOUNT2
34
35 ${LCONF} $NOMOD $portals_opt $lustre_opt $node_opt --cleanup $@ \
36     --dump $TMP/debug $conf_opt
37 rc=$?
38 echo "lconf DONE"
39 BUSY=`dmesg | grep -i destruct`
40 if [ "$BUSY" ]; then
41         echo "$BUSY" 1>&2
42         mv $TMP/debug $TMP/debug-busy.`date +%s`
43         exit 255
44 fi
45 LEAK_LUSTRE=`dmesg | tail -n 30 | grep "obd mem.*leaked"`
46 LEAK_PORTALS=`dmesg | tail -n 20 | grep "Portals memory leaked"`
47 if [ "$LEAK_LUSTRE" -o "$LEAK_PORTALS" ]; then
48         echo "$LEAK_LUSTRE" 1>&2
49         echo "$LEAK_PORTALS" 1>&2
50         mv $TMP/debug $TMP/debug-leak.`date +%s`
51         exit 254
52 fi
53 lsmod | grep portals && echo "modules still loaded" && exit 1
54
55 exit $rc