5 LUSTRE=${LUSTRE:-`dirname $0`/..}
6 LTESTDIR=${LTESTDIR:-"$LUSTRE/../ltest"}
7 PATH=$PATH:$LUSTRE/utils:$LUSTRE/tests
9 . $LTESTDIR/functional/llite/common/common.sh
11 # Allow us to override the setup if we already have a mounted system by
12 # setting SETUP=" " and CLEANUP=" "
13 SETUP=${SETUP:-"setup"}
14 CLEANUP=${CLEANUP:-"cleanup"}
18 # XXX I wish all this stuff was in some default-config.sh somewhere
19 MDSNODE=${MDSNODE:-mdev6}
20 OSTNODE=${OSTNODE:-mdev7}
21 CLIENT=${CLIENT:-mdev8}
22 NETWORKTYPE=${NETWORKTYPE:-tcp}
23 MOUNTPT=${MOUNTPT:-/mnt/lustre}
24 CONFIG=${CONFIG:-recovery-cleanup.xml}
25 MDSDEV=${MDSDEV:-/tmp/mds}
26 OSTDEV=${OSTDEV:-/tmp/ost}
27 MDSSIZE=${MDSSIZE:-100000}
28 OSTSIZE=${OSTSIZE:-100000}
31 $PDSH $MDSNODE "PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests; cd $PWD; $@"
35 $PDSH $CLIENT "PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests; cd $PWD; $@"
39 $PDSH $OSTNODE "PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests; cd $PWD; $@"
43 do_mds "echo 0x121 > /proc/sys/lustre/fail_loc"
44 do_client "$1 & sleep ${TIMEOUT:-5}; sleep 2; kill \$!"
45 do_mds "echo 0 > /proc/sys/lustre/fail_loc"
50 for NODE in $CLIENT $MDSNODE $OSTNODE; do
51 lmc -m $CONFIG --add net --node $NODE --nid `h2$NETWORKTYPE $NODE` \
52 --nettype $NETWORKTYPE || exit 4
54 lmc -m $CONFIG --add mds --node $MDSNODE --mds mds1 --dev $MDSDEV \
55 --size $MDSSIZE || exit 5
56 lmc -m $CONFIG --add ost --node $OSTNODE --ost ost1 --dev $OSTDEV \
57 --size $OSTSIZE || exit 6
58 lmc -m $CONFIG --add mtpt --node $CLIENT --path $MOUNTPT --mds mds1 \
63 do_mds "lconf $@ $CONFIG"
67 do_mds "lconf $@ --cleanup $CONFIG"
71 do_ost "lconf $@ $CONFIG"
75 do_ost "lconf $@ --cleanup $CONFIG"
79 do_client "lconf $@ $CONFIG"
83 do_client "lconf $@ --cleanup $CONFIG"
88 start_mds ${REFORMAT:---reformat}
89 start_ost ${REFORMAT:---reformat}
90 mount_client --timeout=${TIMEOUT:-5} --recovery_upcall=/bin/true
94 do_mds "echo 0 > /proc/sys/lustre/fail_loc"
95 unmount_client $@ || true
96 shutdown_mds $@ || true
97 shutdown_ost $@ || true
101 # wait to make sure we enter recovery
102 # it'd be better if the upcall notified us somehow, I think
103 sleep $(( ${TIMEOUT:-5} + 2 ))
108 unmount_client --force --dump /tmp/client-cleanup-`date +%s`.log
109 mount_client --timeout=${TIMEOUT:-5} --recovery_upcall=/bin/true
112 if [ ! -z "$ONLY" ]; then
119 drop_request "mcreate /mnt/lustre/1" & wait_for_timeout
122 drop_request "tchmod 111 /mnt/lustre/2" & wait_for_timeout
125 drop_request "statone /mnt/lustre/2" & wait_for_timeout
128 do_client "cp /etc/resolv.conf /mnt/lustre/resolv.conf"
129 drop_request "cat /mnt/lustre/resolv.conf > /dev/null" & wait_for_timeout
132 drop_request "mv /mnt/lustre/resolv.conf /mnt/lustre/renamed" & wait_for_timeout
135 drop_request "mlink /mnt/lustre/renamed-again /mnt/lustre/link1" & wait_for_timeout
138 drop_request "munlink /mnt/lustre/link1" & wait_for_timeout
141 $CLEANUP '--dump /tmp/`hostname`-cleanup.log'