Whamcloud - gitweb
LU-11765 ofd: return EAGAIN during 1st CLEANUP_ORPHAN
[fs/lustre-release.git] / lustre / tests / replay-ost-single.sh
index ac9f543..9764e6b 100755 (executable)
@@ -22,15 +22,17 @@ ALWAYS_EXCEPT="$REPLAY_OST_SINGLE_EXCEPT"
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 # bug number for SLOW test:
-#                                  40  (min)"
+# time in minutes:                 40"
 [ "$SLOW" = "no" ] && EXCEPT_SLOW="5"
 
 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
-# bug number for skipped test:      LU-2285
-       ALWAYS_EXCEPT="$ALWAYS_EXCEPT 3"
-# bug number for slowed tests:                          LU-2887
-       #                                               32  12.5  (min)"
-       [ "$SLOW" = "no" ] && EXCEPT_SLOW="$EXCEPT_SLOW 8a  8b"
+# bug number for slow tests:                 LU-2887
+# time in minutes:                           32  12.5"
+       [ "$SLOW" = "no" ] && EXCEPT_SLOW+=" 8a  8b"
+       if [ $MDSCOUNT -gt 1 ]; then
+# bug number for skipped test:
+               ALWAYS_EXCEPT+=""
+       fi
 fi
 
 build_test_filter
@@ -41,8 +43,8 @@ rm -rf $DIR/[df][0-9]*
 
 TDIR=$DIR/d0.${TESTSUITE}
 mkdir -p $TDIR
-$SETSTRIPE $TDIR -i 0 -c 1
-$GETSTRIPE $TDIR
+$LFS setstripe $TDIR -i 0 -c 1
+$LFS getstripe $TDIR
 
 test_0a() {
        zconf_umount $(hostname) $MOUNT -f
@@ -159,7 +161,8 @@ test_5() {
        if (( size > GB )); then
                size=$GB
        fi
-       local iozone_opts="-i 0 -i 1 -i 2 -+d -r 4 -s $size -f $TDIR/$tfile"
+       # no random I/O (-i 2) as it's very slow with ZFS
+       local iozone_opts="-i 0 -i 1 -+d -r 4 -s $size -f $TDIR/$tfile"
 
        iozone_bg $iozone_opts &
        local pid=$!
@@ -196,7 +199,7 @@ test_6() {
 
        local before=$(kbytesfree)
        dd if=/dev/urandom bs=4096 count=1280 of=$f || error "dd failed"
-       $GETSTRIPE $f || error "$GETSTRIPE $f failed"
+       $LFS getstripe $f || error "$LFS getstripe $f failed"
        local stripe_index=$(lfs getstripe -i $f)
 
        sync
@@ -395,7 +398,11 @@ run_test 8e "Verify that ptlrpc resends request on -EINPROGRESS"
 test_9() {
        [ $(lustre_version_code ost1) -ge $(version_code 2.6.54) ] ||
                { skip "Need OST version at least 2.6.54"; return; }
-       $SETSTRIPE -i 0 -c 1 $DIR/$tfile || "setstripe failed"
+       $LFS setstripe -i 0 -c 1 $DIR/$tfile || error "setstripe failed"
+
+       # LU-1573 - Add duplicate write to generate grants
+       dd if=/dev/zero of=$DIR/$tfile count=1 bs=1M > /dev/null ||
+               error "First write failed"
        replay_barrier ost1
        # do IO
        dd if=/dev/zero of=$DIR/$tfile count=1 bs=1M > /dev/null ||
@@ -413,6 +420,68 @@ test_9() {
 }
 run_test 9 "Verify that no req deadline happened during recovery"
 
+test_10() {
+       rm -f $TDIR/$tfile
+
+       dd if=/dev/zero of=$TDIR/$tfile count=10 || error "dd failed"
+
+       #define OBD_FAIL_OSC_DELAY_IO            0x414
+       $LCTL set_param fail_val=60 fail_loc=0x414
+       cancel_lru_locks OST0000-osc &
+       sleep 2
+       facet_failover ost1 || error "failover: $?"
+
+       #define OBD_FAIL_LDLM_GRANT_CHECK        0x32a
+       $LCTL set_param fail_loc=0x32a
+       stat $TDIR/$tfile
+
+       wait
+}
+run_test 10 "conflicting PW & PR locks on a client"
+
+test_12() {
+       [ $FAILURE_MODE != "HARD" ] &&
+               skip "Test needs FAILURE_MODE HARD" && return 0
+       remote_ost || { skip "need remote OST" && return 0; }
+
+       local tmp=$TMP/$tdir
+       local dir=$DIR/$tdir
+       declare -a pids
+
+
+       mkdir -p $tmp || error "can't create $tmp"
+       mkdir -p $dir || error "can't create $dir"
+
+       $LFS setstripe -c 1 -i 0 $dir
+
+       for i in `seq 1 10`; do mkdir $dir/d$i; done
+
+       #define OBD_FAIL_OST_DELAY_TRANS        0x245
+       do_facet ost1 "$LCTL set_param fail_loc=0x245" ||
+               error "can't set fail_loc"
+
+       for i in `seq 1 10`;
+       do
+               createmany -o $dir/d$i/$(openssl rand -base64 12) 500 &
+               pids+=($!)
+       done
+       echo "Waiting createmany pids"
+       wait ${pids[@]}
+
+       ls -lR $dir > $tmp/ls_r_out 2>&1&
+       local ls_pid=$!
+
+       facet_failover ost1
+
+       echo "starting wait for ls -l"
+       wait $ls_pid
+       grep "?\|No such file or directory" $tmp/ls_r_out &&
+               error "Found file without object on OST"
+       rm -rf $tmp
+       rm -rf $dir
+}
+run_test 12 "check stat after OST failover"
+
 complete $SECONDS
 check_and_cleanup_lustre
 exit_status