Whamcloud - gitweb
- merge 0.7rc1 from b_devel to HEAD (20030612 merge point)
[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 [ "$1" = "--force" ]; then
19   force="--force"
20 fi
21
22 if [ "$LDAPURL" ]; then
23     conf_opt="--ldapurl $LDAPURL --config $NAME"
24 else
25     if [ ! -f $config -o $mkconfig -nt $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 ${LCONF} $portals_opt $lustre_opt $node_opt --cleanup $force \
35     --dump $TMP/debug $conf_opt
36 rc=$?
37 BUSY=`dmesg | grep -i destruct`
38 if [ "$BUSY" ]; then
39         echo "$BUSY" 1>&2
40         mv $TMP/debug $TMP/debug-busy.`date +%s`
41         exit 255
42 fi
43 LEAK_LUSTRE=`dmesg | grep "obd mem.*leaked" | tail -1 | grep -v "leaked: 0"`
44 LEAK_PORTALS=`dmesg | tail -20 | grep "Portals memory leaked"`
45 if [ "$LEAK_LUSTRE" -o "$LEAK_PORTALS" ]; then
46         echo "$LEAK_LUSTRE" 1>&2
47         echo "$LEAK_PORTALS" 1>&2
48         mv $TMP/debug $TMP/debug-leak.`date +%s`
49         exit 254
50 fi
51
52 exit $rc