Whamcloud - gitweb
3ce5dfa228f7145484b2d2905d900750e5543e42
[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 ${LCONF} $NOMOD $portals_opt $lustre_opt $node_opt --cleanup $@ \
33     --dump $TMP/debug $conf_opt
34 rc=$?
35 echo "lconf DONE"
36 BUSY=`dmesg | grep -i destruct`
37 if [ "$BUSY" ]; then
38         echo "$BUSY" 1>&2
39         mv $TMP/debug $TMP/debug-busy.`date +%s`
40         exit 255
41 fi
42 LEAK_LUSTRE=`dmesg | grep "obd mem.*leaked" | tail -1 | grep -v "leaked: 0"`
43 LEAK_PORTALS=`dmesg | tail -20 | grep "Portals memory leaked"`
44 if [ "$LEAK_LUSTRE" -o "$LEAK_PORTALS" ]; then
45         echo "$LEAK_LUSTRE" 1>&2
46         echo "$LEAK_PORTALS" 1>&2
47         mv $TMP/debug $TMP/debug-leak.`date +%s`
48         exit 254
49 fi
50
51 exit $rc