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 grep " $MOUNT " /proc/mounts || 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=4096 count=1280 | 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=4096 count=1280 | 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 awk '{total+=$1} END {print total}' /proc/fs/lustre/osc/OSC_*MNT*/kbytesfree
141 sync && sleep 2 && sync # wait for delete thread
143 dd if=/dev/urandom bs=4096 count=1280 of=$f
144 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
145 do_facet mds "sysctl -w lustre.fail_loc=0x80000119"
147 sleep 1 # ensure we have a fresh statfs
148 after_dd=`kbytesfree`
149 log "before: $before after_dd: $after_dd"
150 (( $before > $after_dd )) || return 1
153 $CHECKSTAT -t file $f && return 2 || true
155 # let the delete happen
158 log "before: $before after: $after"
159 (( $before <= $after + 40 )) || return 3 # take OST logs into account
161 run_test 6 "Fail OST before obd_destroy"
166 sync && sleep 2 && sync # wait for delete thread
168 dd if=/dev/urandom bs=4096 count=1280 of=$f
170 after_dd=`kbytesfree`
171 log "before: $before after_dd: $after_dd"
172 (( $before > $after_dd )) || return 1
176 $CHECKSTAT -t file $f && return 2 || true
178 # let the delete happen
181 log "before: $before after: $after"
182 (( $before <= $after + 40 )) || return 3 # take OST logs into account
184 run_test 7 "Fail OST before obd_destroy"
186 equals_msg test complete, cleaning up