Whamcloud - gitweb
Added support to specify the lustre obj dir.
[fs/lustre-release.git] / lustre / tests / llmountcleanup.sh
1 #!/bin/sh
2
3 LCONF=${LCONF:-../utils/lconf}
4 NAME=${NAME:-local}
5 TMP=${TMP:-/tmp}
6
7 config=$NAME.xml
8 mkconfig=$NAME.sh
9
10 if [ "$PORTALS" ]; then
11   portals_opt="--portals=$PORTALS"
12 fi
13
14 if [ "$LUSTRE" ]; then
15   lustre_opt="--lustre=$LUSTRE"
16 fi
17
18 if [ ! -f $config ]; then
19    sh $mkconfig $config || exit 1
20 fi
21
22 sync; sleep 2; sync
23 ${LCONF} $portals_opt $lustre_opt --cleanup --dump $TMP/debug $config
24 rc=$?
25 BUSY=`dmesg | grep -i destruct`
26 if [ "$BUSY" ]; then
27         echo "$BUSY" 1>&2
28         mv $TMP/debug $TMP/debug-busy.`date +%s`
29         exit 255
30 fi
31 LEAK_LUSTRE=`dmesg | tail -20 | grep -v "leaked: 0" | grep leaked`
32 LEAK_PORTALS=`dmesg | tail -20 | grep "Portals memory leaked"`
33 if [ "$LEAK_LUSTRE" -o "$LEAK_PORTALS" ]; then
34         echo "$LEAK_LUSTRE" 1>&2
35         echo "$LEAK_PORTALS" 1>&2
36         mv $TMP/debug $TMP/debug-leak.`date +%s`
37         exit 254
38 fi
39
40 exit $rc