Whamcloud - gitweb
Merge b_md into HEAD
[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 [ ! -f $config ]; then
15    sh $mkconfig $config || exit 1
16 fi
17
18 sync; sleep 2; sync
19 ${LCONF} $portals_opt --cleanup --dump $TMP/debug $config
20 rc=$?
21 BUSY=`dmesg | grep -i destruct`
22 if [ "$BUSY" ]; then
23         echo "$BUSY" 1>&2
24         mv $TMP/debug $TMP/debug-busy.`date +%s`
25         exit 255
26 fi
27 LEAK_LUSTRE=`dmesg | tail -20 | grep -v "leaked: 0" | grep leaked`
28 LEAK_PORTALS=`dmesg | tail -20 | grep "Portals memory leaked"`
29 if [ "$LEAK_LUSTRE" -o "$LEAK_PORTALS" ]; then
30         echo "$LEAK_LUSTRE" 1>&2
31         echo "$LEAK_PORTALS" 1>&2
32         mv $TMP/debug $TMP/debug-leak.`date +%s`
33         exit 254
34 fi
35
36 exit $rc