5 LUSTRE=${LUSTRE:-`dirname $0`/..}
6 . $LUSTRE/tests/test-framework.sh
10 . ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
12 ostfailover_HOST=${ostfailover_HOST:-$ost_HOST}
16 # test 5 needs a larger fs than what local normally has
20 add_mds mds --dev $MDSDEV --size $MDSSIZE
21 add_lov lov1 mds --stripe_sz $STRIPE_BYTES\
22 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
23 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE --failover
24 if [ ! -z "$ostfailover_HOST" ]; then
25 add_ostfailover ost --dev $OSTDEV --size $OSTSIZE
27 add_client client mds --lov lov1 --path $MOUNT
31 # make sure we are using the primary MDS, so the config log will
32 # be able to clean up properly.
33 activeost=`facet_active ost`
34 if [ $activeost != "ost" ]; then
37 zconf_umount `hostname` $MOUNT
38 stop mds ${FORCE} $MDSLCONFARGS
39 stop ost ${FORCE} --dump cleanup.log
42 if [ "$ONLY" == "cleanup" ]; then
43 sysctl -w portals.debug=0
50 SETUP=${SETUP:-"setup"}
51 CLEANUP=${CLEANUP:-"cleanup"}
56 start ost --reformat $OSTLCONFARGS
57 [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
58 start mds --reformat $MDSLCONFARGS
59 zconf_mount `hostname` $MOUNT
68 cp /etc/profile $DIR/$tfile
70 diff /etc/profile $DIR/$tfile
73 run_test 0 "empty replay"
78 $CHECKSTAT -t file $DIR/$tfile || return 1
85 echo "tag-$i" > $DIR/$tfile-$i
89 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
93 run_test 2 "|x| 10 open(O_CREAT)s"
96 verify=$ROOT/tmp/verify-$$
97 dd if=/dev/urandom bs=1024 count=5120 | tee $verify > $DIR/$tfile &
101 wait $ddpid || return 1
102 cmp $verify $DIR/$tfile || return 2
103 rm -f $verify $DIR/$tfile
105 run_test 3 "Fail OST during write, with verification"
108 verify=$ROOT/tmp/verify-$$
109 dd if=/dev/urandom bs=1024 count=5120 | tee $verify > $DIR/$tfile
110 # invalidate cache, so that we're reading over the wire
111 for i in /proc/fs/lustre/ldlm/namespaces/OSC_*MNT*; do
112 echo -n clear > $i/lru_size
114 cmp $verify $DIR/$tfile &
117 wait $cmppid || return 1
118 rm -f $verify $DIR/$tfile
120 run_test 4 "Fail OST during read, with verification"
123 IOZONE_OPTS="-i 0 -i 1 -i 2 -+d -r 64 -s 1g"
124 iozone $IOZONE_OPTS -f $DIR/$tfile &
129 wait $PID || return 1
132 run_test 5 "Fail OST during iozone"
135 cat /proc/fs/lustre/osc/OSC_*MNT*/kbytesfree | awk '{total+=$1} END {print total}'
141 dd if=/dev/urandom bs=1024 count=5120 of=$f
142 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
143 do_facet mds "sysctl -w lustre.fail_loc=0x80000119"
145 after_dd=`kbytesfree`
146 echo "before: $before after_dd: $after_dd"
147 (( before > after_dd )) || return 1
150 $CHECKSTAT -t file $f && return 2 || true
152 # let the delete happen
155 echo "before: $before after: $after"
156 (( before == after )) || return 3
158 run_test 6 "Fail OST before obd_destroy"
163 dd if=/dev/urandom bs=1024 count=5120 of=$f
165 after_dd=`kbytesfree`
166 echo "before: $before after_dd: $after_dd"
167 (( before > after_dd )) || return 1
171 $CHECKSTAT -t file $f && return 2 || true
173 # let the delete happen
176 echo "before: $before after: $after"
177 (( before == after )) || return 3
179 run_test 7 "Fail OST before obd_destroy"
181 equals_msg test complete, cleaning up