5 LUSTRE=${LUSTRE:-`dirname $0`/..}
6 . $LUSTRE/tests/test-framework.sh
10 . ${CONFIG:=$LUSTRE/tests/cfg/lmv.sh}
12 ostfailover_HOST=${ostfailover_HOST:-$ost_HOST}
16 # test 5 needs a larger fs than what local normally has
20 if [ "$MDSCOUNT" -gt 1 ]; then
22 for mds in `mds_list`; do
23 MDSDEV=$TMP/${mds}-`hostname`
24 add_mds $mds --dev $MDSDEV --size $MDSSIZE --lmv lmv1_svc
26 add_lov_to_lmv lov1 lmv1_svc --stripe_sz $STRIPE_BYTES \
27 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
30 add_mds mds1 --dev $MDSDEV --size $MDSSIZE
31 add_lov lov1 mds1 --stripe_sz $STRIPE_BYTES \
32 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
37 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE --failover
38 if [ ! -z "$ostfailover_HOST" ]; then
39 add_ostfailover ost --dev $OSTDEV --size $OSTSIZE
41 add_client client $MDS --lov lov1 --path $MOUNT
45 # make sure we are using the primary MDS, so the config log will
46 # be able to clean up properly.
47 activeost=`facet_active ost`
48 if [ $activeost != "ost" ]; then
51 zconf_umount `hostname` $MOUNT
52 for mds in `mds_list`; do
53 stop $mds ${FORCE} $MDSLCONFARGS
55 stop ost ${FORCE} --dump cleanup.log
58 if [ "$ONLY" == "cleanup" ]; then
59 sysctl -w portals.debug=0
66 SETUP=${SETUP:-"setup"}
67 CLEANUP=${CLEANUP:-"cleanup"}
72 start ost --reformat $OSTLCONFARGS
73 [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
74 for mds in `mds_list`; do
75 start $mds --reformat $MDSLCONFARGS
77 grep " $MOUNT " /proc/mounts || zconf_mount `hostname` $MOUNT
86 cp /etc/profile $DIR/$tfile
88 diff /etc/profile $DIR/$tfile
91 run_test 0 "empty replay"
96 $CHECKSTAT -t file $DIR/$tfile || return 1
102 for i in `seq 10`; do
103 echo "tag-$i" > $DIR/$tfile-$i
106 for i in `seq 10`; do
107 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
111 run_test 2 "|x| 10 open(O_CREAT)s"
114 verify=$ROOT/tmp/verify-$$
115 dd if=/dev/urandom bs=4096 count=1280 | tee $verify > $DIR/$tfile &
119 wait $ddpid || return 1
120 cmp $verify $DIR/$tfile || return 2
121 rm -f $verify $DIR/$tfile
123 run_test 3 "Fail OST during write, with verification"
126 verify=$ROOT/tmp/verify-$$
127 dd if=/dev/urandom bs=4096 count=1280 | tee $verify > $DIR/$tfile
128 # invalidate cache, so that we're reading over the wire
129 for i in /proc/fs/lustre/ldlm/namespaces/OSC_*MNT*; do
130 echo -n clear > $i/lru_size
132 cmp $verify $DIR/$tfile &
135 wait $cmppid || return 1
136 rm -f $verify $DIR/$tfile
138 run_test 4 "Fail OST during read, with verification"
141 FREE=`df -P -h $DIR | tail -n 1 | awk '{ print $3 }'`
145 IOZONE_OPTS="-i 0 -i 1 -i 2 -+d -r 4 -s $FREE"
146 iozone $IOZONE_OPTS -f $DIR/$tfile &
151 wait $PID || return 1
154 run_test 5 "Fail OST during iozone"
157 awk '{total+=$1} END {print total}' /proc/fs/lustre/osc/OSC_*MNT*/kbytesfree
163 sync && sleep 2 && sync # wait for delete thread
165 dd if=/dev/urandom bs=4096 count=1280 of=$f
166 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
167 do_facet mds "sysctl -w lustre.fail_loc=0x80000119"
169 sleep 1 # ensure we have a fresh statfs
170 after_dd=`kbytesfree`
171 log "before: $before after_dd: $after_dd"
172 (( $before > $after_dd )) || return 1
175 $CHECKSTAT -t file $f && return 2 || true
177 # let the delete happen
180 log "before: $before after: $after"
181 (( $before <= $after + 40 )) || return 3 # take OST logs into account
183 run_test 6 "Fail OST before obd_destroy"
188 sync && sleep 2 && sync # wait for delete thread
190 dd if=/dev/urandom bs=4096 count=1280 of=$f
192 after_dd=`kbytesfree`
193 log "before: $before after_dd: $after_dd"
194 (( $before > $after_dd )) || return 1
198 $CHECKSTAT -t file $f && return 2 || true
200 # let the delete happen
203 log "before: $before after: $after"
204 (( $before <= $after + 40 )) || return 3 # take OST logs into account
206 run_test 7 "Fail OST before obd_destroy"
208 equals_msg test complete, cleaning up