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-`hostname`}
26 MDSSIZE=${MDSSIZE:-100000}
27 FSTYPE=${FSTYPE:-ext3}
28 OSTDEV=${OSTDEV:-/tmp/ost-`hostname`}
29 OSTSIZE=${OSTSIZE:-100000}
32 $PDSH $MDSNODE "PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests; cd $PWD; $@" || exit $?
36 $PDSH $CLIENT "PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests; cd $PWD; $@" || exit $?
40 $PDSH $OSTNODE "PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests; cd $PWD; $@" || exit $?
44 do_mds "echo 0x121 > /proc/sys/lustre/fail_loc"
45 do_client "$1 & sleep ${TIMEOUT:-5}; sleep 2; kill \$!"
46 do_mds "echo 0 > /proc/sys/lustre/fail_loc"
51 for NODE in $CLIENT $MDSNODE $OSTNODE; do
52 lmc -m $CONFIG --add net --node $NODE --nid `h2$NETWORKTYPE $NODE` \
53 --nettype $NETWORKTYPE || exit 4
55 lmc -m $CONFIG --add mds --node $MDSNODE --mds mds1 --fstype $FSTYPE \
56 --dev $MDSDEV --size $MDSSIZE || exit 5
57 lmc -m $CONFIG --add lov --lov lov1 --mds mds1 --stripe_sz 65536 \
58 --stripe_cnt 0 --stripe_pattern 0 || exit 6
59 lmc -m $CONFIG --add ost --nspath /mnt/ost_ns --node $OSTNODE \
60 --lov lov1 --dev $OSTDEV --size $OSTSIZE --fstype $FSTYPE || exit 7
61 lmc -m $CONFIG --add mtpt --node $CLIENT --path $MOUNTPT --mds mds1 \
66 do_mds "lconf $@ $CONFIG"
70 do_mds "lconf $@ --cleanup $CONFIG"
74 do_ost "lconf $@ $CONFIG"
78 do_ost "lconf $@ --cleanup $CONFIG"
82 do_client "lconf $@ $CONFIG"
86 do_client "lconf $@ --cleanup $CONFIG"
91 start_mds ${REFORMAT:---reformat}
92 start_ost ${REFORMAT:---reformat}
93 mount_client --timeout=${TIMEOUT:-5} --lustre_upcall=/bin/true
97 do_mds "echo 0 > /proc/sys/lustre/fail_loc"
98 unmount_client $@ || exit 97
99 shutdown_mds $@ || exit 98
100 shutdown_ost $@ || exit 99
104 # wait to make sure we enter recovery
105 # it'd be better if the upcall notified us somehow, I think
106 sleep $(( ${TIMEOUT:-5} + 2 ))
111 unmount_client --force --dump /tmp/client-cleanup-`date +%s`.log
112 mount_client --timeout=${TIMEOUT:-5} --lustre_upcall=/bin/true
115 if [ ! -z "$ONLY" ]; then
122 drop_request "mcreate /mnt/lustre/1" & wait_for_timeout
125 drop_request "tchmod 111 /mnt/lustre/2" & wait_for_timeout
128 drop_request "statone /mnt/lustre/2" & wait_for_timeout
131 do_client "cp /etc/resolv.conf /mnt/lustre/resolv.conf"
132 drop_request "cat /mnt/lustre/resolv.conf > /dev/null" & wait_for_timeout
135 drop_request "mv /mnt/lustre/resolv.conf /mnt/lustre/renamed" & wait_for_timeout
138 drop_request "mlink /mnt/lustre/renamed-again /mnt/lustre/link1" & wait_for_timeout
141 drop_request "munlink /mnt/lustre/link1" & wait_for_timeout
144 $CLEANUP '--dump /tmp/`hostname`-cleanup.log'