5 LUSTRE=${LUSTRE:-`dirname $0`/..}
6 LTESTDIR=${LTESTDIR:-$LUSTRE/../ltest}
7 PATH=$PATH:$LUSTRE/utils:$LUSTRE/tests
9 RLUSTRE=${RLUSTRE:-$LUSTRE}
12 . $LUSTRE/tests/test-framework.sh
14 # Allow us to override the setup if we already have a mounted system by
15 # setting SETUP=" " and CLEANUP=" "
16 SETUP=${SETUP:-"setup"}
17 CLEANUP=${CLEANUP:-"cleanup"}
19 PDSH=${PDSH:-'pdsh -S -w'}
21 # XXX I wish all this stuff was in some default-config.sh somewhere
22 MDSNODE=${MDSNODE:-mdev6}
23 OSTNODE=${OSTNODE:-mdev7}
24 CLIENT=${CLIENT:-mdev8}
25 NETWORKTYPE=${NETWORKTYPE:-tcp}
26 MOUNTPT=${MOUNTPT:-/mnt/lustre}
27 CONFIG=${CONFIG:-recovery-small.xml}
28 MDSDEV=${MDSDEV:-/tmp/mds-`hostname`}
29 MDSSIZE=${MDSSIZE:-100000}
30 OSTDEV=${OSTDEV:-/tmp/ost-`hostname`}
31 OSTSIZE=${OSTSIZE:-100000}
32 UPCALL=${UPCALL:-$RPWD/recovery-small-upcall.sh}
33 FSTYPE=${FSTYPE:-ext3}
36 $PDSH $MDSNODE "PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests; cd $RPWD; $@" || exit $?
40 $PDSH $CLIENT "PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests; cd $RPWD; $@" || exit $?
44 $PDSH $OSTNODE "PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests; cd $RPWD; $@" || exit $?
48 # OBD_FAIL_MDS_ALL_REQUEST_NET
49 do_mds "echo 0x123 > /proc/sys/lustre/fail_loc"
51 do_mds "echo 0 > /proc/sys/lustre/fail_loc"
55 # OBD_FAIL_MDS_ALL_REPLY_NET
56 do_mds "echo 0x122 > /proc/sys/lustre/fail_loc"
58 do_mds "echo 0 > /proc/sys/lustre/fail_loc"
62 #define OBD_FAIL_OST_BRW_PAUSE_BULK 0x214
63 do_ost "echo 0x214 > /proc/sys/lustre/fail_loc"
66 do_ost "echo 0 > /proc/sys/lustre/fail_loc"
70 for NODE in $CLIENT $MDSNODE $OSTNODE; do
71 lmc -m $CONFIG --add net --node $NODE --nid `h2$NETWORKTYPE $NODE` \
72 --nettype $NETWORKTYPE || exit 4
74 lmc -m $CONFIG --add mds --node $MDSNODE --mds mds1 --dev $MDSDEV \
75 --size $MDSSIZE --fstype $FSTYPE || exit 5
76 lmc -m $CONFIG --add lov --lov lov1 --mds mds1 --stripe_sz 65536 \
77 --stripe_cnt 0 --stripe_pattern 0 || exit 6
78 lmc -m $CONFIG --add ost --nspath /mnt/ost_ns --node $OSTNODE \
79 --lov lov1 --dev $OSTDEV --size $OSTSIZE --fstype $FSTYPE || exit 7
80 lmc -m $CONFIG --add mtpt --node $CLIENT --path $MOUNTPT --mds mds1 \
85 do_mds "lconf $@ $CONFIG"
89 do_mds "lconf $@ --cleanup $CONFIG"
93 do_ost "lconf $@ $CONFIG"
97 do_ost "lconf $@ --cleanup $CONFIG"
101 do_client "lconf $@ $CONFIG"
105 do_client "lconf $@ --cleanup $CONFIG"
109 start_ost --timeout=$TIMEOUT ${REFORMAT}
110 start_mds --timeout=$TIMEOUT ${REFORMAT}
111 # XXX we should write our own upcall, when we move this somewhere better.
112 mount_client --timeout=${TIMEOUT} \
113 --lustre_upcall=$UPCALL
117 do_mds "echo 0 > /proc/sys/lustre/fail_loc"
118 unmount_client $@ || exit 97
119 shutdown_mds $@ || exit 98
120 shutdown_ost $@ || exit 99
125 do_mds 'echo -e "device \$mds1\\nprobe\\nnotransno\\nreadonly" | lctl'
130 do_client "df -h $MOUNTPT" # trigger failover, if we haven't already
133 if [ ! -z "$ONLY" ]; then
140 REFORMAT=--reformat $SETUP
143 drop_request "mcreate /mnt/lustre/1"
144 drop_reply "mcreate /mnt/lustre/2"
145 # replay "mcreate /mnt/lustre/3"
147 drop_request "tchmod 111 /mnt/lustre/2"
148 drop_reply "tchmod 666 /mnt/lustre/2"
149 # replay "tchmod 444 /mnt/lustre/2"
151 drop_request "statone /mnt/lustre/2"
152 drop_reply "statone /mnt/lustre/2"
153 # replay "statone /mnt/lustre/2"
155 do_client "cp /etc/resolv.conf /mnt/lustre/resolv.conf"
156 drop_request "cat /mnt/lustre/resolv.conf > /dev/null"
157 drop_reply "cat /mnt/lustre/resolv.conf > /dev/null"
159 drop_request "mv /mnt/lustre/resolv.conf /mnt/lustre/renamed"
160 drop_reply "mv /mnt/lustre/renamed /mnt/lustre/renamed-again"
162 drop_request "mlink /mnt/lustre/renamed-again /mnt/lustre/link1"
163 drop_reply "mlink /mnt/lustre/renamed-again /mnt/lustre/link2"
165 drop_request "munlink /mnt/lustre/link1"
166 drop_reply "munlink /mnt/lustre/link2"
169 drop_reply "touch /mnt/lustre/renamed"