5 PTLDEBUG=${PTLDEBUG:--1}
6 LUSTRE=${LUSTRE:-`dirname $0`/..}
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"
24 # It is replay-ost-single, after all
29 REFORMAT=--reformat cleanup_and_setup_lustre
30 rm -rf $DIR/${TESTSUITE}/[df][0-9]* # bug 13798 new t-f tdir staff
31 rm -rf $DIR/[df][0-9]*
34 zconf_umount `hostname` $MOUNT -f
35 # needs to run during initial client->OST connection
36 #define OBD_FAIL_OST_ALL_REPLY_NET 0x211
37 do_facet ost "sysctl -w lustre.fail_loc=0x80000211"
38 zconf_mount `hostname` $MOUNT && df $MOUNT || error "0a mount fail"
40 run_test 0a "target handle mismatch (bug 5317) `date +%H:%M:%S`"
44 cp /etc/profile $DIR/$tfile
46 diff /etc/profile $DIR/$tfile
49 run_test 0b "empty replay"
54 $CHECKSTAT -t file $DIR/$tfile || return 1
61 echo "tag-$i" > $DIR/$tfile-$i
65 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
69 run_test 2 "|x| 10 open(O_CREAT)s"
72 verify=$ROOT/tmp/verify-$$
73 dd if=/dev/urandom bs=4096 count=1280 | tee $verify > $DIR/$tfile &
77 wait $ddpid || return 1
78 cmp $verify $DIR/$tfile || return 2
79 rm -f $verify $DIR/$tfile
81 run_test 3 "Fail OST during write, with verification"
84 verify=$ROOT/tmp/verify-$$
85 dd if=/dev/urandom bs=4096 count=1280 | tee $verify > $DIR/$tfile
86 # invalidate cache, so that we're reading over the wire
88 cmp $verify $DIR/$tfile &
91 wait $cmppid || return 1
92 rm -f $verify $DIR/$tfile
94 run_test 4 "Fail OST during read, with verification"
97 [ -z "`which iozone 2> /dev/null`" ] && log "iozone missing" && return
98 FREE=`df -P -h $DIR | tail -n 1 | awk '{ print $3 }'`
102 IOZONE_OPTS="-i 0 -i 1 -i 2 -+d -r 4 -s $FREE"
103 iozone $IOZONE_OPTS -f $DIR/$tfile &
112 [ $RC -ne 0 ] && return $RC || true
114 run_test 5 "Fail OST during iozone"
117 awk '{total+=$1} END {print total}' /proc/fs/lustre/osc/*-osc-*/kbytesfree
123 sync && sleep 2 && sync # wait for delete thread
125 dd if=/dev/urandom bs=4096 count=1280 of=$f || return 28
128 sleep 2 # ensure we have a fresh statfs
130 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
131 do_facet mds "sysctl -w lustre.fail_loc=0x80000119"
132 after_dd=`kbytesfree`
133 log "before: $before after_dd: $after_dd"
134 (( $before > $after_dd )) || return 1
137 $CHECKSTAT -t file $f && return 2 || true
139 # let the delete happen
142 log "before: $before after: $after"
143 (( $before <= $after + 40 )) || return 3 # take OST logs into account
145 run_test 6 "Fail OST before obd_destroy"
150 sync && sleep 5 && sync # wait for delete thread
152 dd if=/dev/urandom bs=4096 count=1280 of=$f || return 4
154 sleep 2 # ensure we have a fresh statfs
156 after_dd=`kbytesfree`
157 log "before: $before after_dd: $after_dd"
158 (( $before > $after_dd )) || return 1
162 $CHECKSTAT -t file $f && return 2 || true
164 # let the delete happen
167 log "before: $before after: $after"
168 (( $before <= $after + 40 )) || return 3 # take OST logs into account
170 run_test 7 "Fail OST before obd_destroy"
172 equals_msg `basename $0`: test complete, cleaning up
173 check_and_cleanup_lustre
174 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true