5 PTLDEBUG=${PTLDEBUG:--1}
6 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
9 . $LUSTRE/tests/test-framework.sh
11 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
13 ostfailover_HOST=${ostfailover_HOST:-$ost_HOST}
14 #failover= must be defined in OST_MKFS_OPTIONS if ostfailover_HOST != ost_HOST
16 # Tests that fail on uml
17 CPU=`awk '/model/ {print $4}' /proc/cpuinfo`
18 [ "$CPU" = "UML" ] && EXCEPT="$EXCEPT 6"
22 ALWAYS_EXCEPT="$REPLAY_OST_SINGLE_EXCEPT"
25 [ "$SLOW" = "no" ] && EXCEPT_SLOW=""
27 # It is replay-ost-single, after all
32 REFORMAT=--reformat cleanup_and_setup_lustre
33 rm -rf $DIR/[df][0-9]*
36 zconf_umount `hostname` $MOUNT -f
37 # needs to run during initial client->OST connection
38 #define OBD_FAIL_OST_ALL_REPLY_NET 0x211
39 do_facet ost "lctl set_param fail_loc=0x80000211"
40 zconf_mount `hostname` $MOUNT && df $MOUNT || error "0a mount fail"
42 run_test 0a "target handle mismatch (bug 5317) `date +%H:%M:%S`"
46 cp /etc/profile $DIR/$tfile
48 diff /etc/profile $DIR/$tfile
51 run_test 0b "empty replay"
56 $CHECKSTAT -t file $DIR/$tfile || return 1
63 echo "tag-$i" > $DIR/$tfile-$i
67 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
71 run_test 2 "|x| 10 open(O_CREAT)s"
74 verify=$ROOT/tmp/verify-$$
75 dd if=/dev/urandom bs=4096 count=1280 | tee $verify > $DIR/$tfile &
79 wait $ddpid || return 1
80 cmp $verify $DIR/$tfile || return 2
81 rm -f $verify $DIR/$tfile
83 run_test 3 "Fail OST during write, with verification"
86 verify=$ROOT/tmp/verify-$$
87 dd if=/dev/urandom bs=4096 count=1280 | tee $verify > $DIR/$tfile
88 # invalidate cache, so that we're reading over the wire
90 cmp $verify $DIR/$tfile &
93 wait $cmppid || return 1
94 rm -f $verify $DIR/$tfile
96 run_test 4 "Fail OST during read, with verification"
99 [ -z "`which iozone 2> /dev/null`" ] && log "iozone missing" && return
100 FREE=`df -P $DIR | tail -n 1 | awk '{ print $4/2 }'`
101 GB=1048576 # 1048576KB == 1GB
102 if (( FREE > GB )); then
105 IOZONE_OPTS="-i 0 -i 1 -i 2 -+d -r 4 -s $FREE"
106 iozone $IOZONE_OPTS -f $DIR/$tfile &
115 [ $RC -ne 0 ] && return $RC || true
117 run_test 5 "Fail OST during iozone"
120 lctl get_param -n osc.*-osc-*.kbytesfree | awk '{total+=$1} END {print total}'
126 sync && sleep 2 && sync # wait for delete thread
128 dd if=/dev/urandom bs=4096 count=1280 of=$f || return 28
131 sleep 2 # ensure we have a fresh statfs
133 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
134 do_facet mds "lctl set_param fail_loc=0x80000119"
135 after_dd=`kbytesfree`
136 log "before: $before after_dd: $after_dd"
137 (( $before > $after_dd )) || return 1
140 $CHECKSTAT -t file $f && return 2 || true
142 # let the delete happen
145 log "before: $before after: $after"
146 (( $before <= $after + 40 )) || return 3 # take OST logs into account
148 run_test 6 "Fail OST before obd_destroy"
153 sync && sleep 5 && sync # wait for delete thread
155 dd if=/dev/urandom bs=4096 count=1280 of=$f || return 4
157 sleep 2 # ensure we have a fresh statfs
159 after_dd=`kbytesfree`
160 log "before: $before after_dd: $after_dd"
161 (( $before > $after_dd )) || return 1
165 $CHECKSTAT -t file $f && return 2 || true
167 # let the delete happen
170 log "before: $before after: $after"
171 (( $before <= $after + 40 )) || return 3 # take OST logs into account
173 run_test 7 "Fail OST before obd_destroy"
175 equals_msg `basename $0`: test complete, cleaning up
176 check_and_cleanup_lustre
177 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true