Whamcloud - gitweb
LU-2902 test: Debug for roc_hit v1
[fs/lustre-release.git] / lustre / tests / sanity.sh
index f16be85..6c4ce0a 100644 (file)
@@ -9,7 +9,7 @@ set -e
 
 ONLY=${ONLY:-"$*"}
 # bug number for skipped test: 13297 2108 9789 3637 9789 3561 12622 5188
-ALWAYS_EXCEPT="                27u   42a  42b  42c  42d  45   51d   68b   $SANITY_EXCEPT"
+ALWAYS_EXCEPT="                42a  42b  42c  42d  45   51d   68b   $SANITY_EXCEPT"
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 # with LOD/OSP landing
@@ -58,7 +58,7 @@ init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/${NAME}.sh}
 init_logging
 
-[ "$SLOW" = "no" ] && EXCEPT_SLOW="24o 24v 27m 36f 36g 36h 51b 60c 63 64b 68 71 73 77f 78 101a 115 120g 124b"
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="24o 27m 64b 68 71 77f 78 115 124b"
 
 [ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
 # bug number for skipped test:        LU-2834 LU-1593 LU-2610 LU-2833 LU-1957 LU-2805
@@ -1484,6 +1484,7 @@ test_27u() { # bug 4900
 #define OBD_FAIL_MDS_OSC_PRECREATE      0x139
         do_facet $SINGLEMDS lctl set_param fail_loc=0x139
         test_mkdir -p $DIR/$tdir
+       rm -rf $DIR/$tdir/*
         createmany -o $DIR/$tdir/t- 1000
         do_facet $SINGLEMDS lctl set_param fail_loc=0
 
@@ -1804,6 +1805,32 @@ test_27B() { # LU-2523
 }
 run_test 27B "call setstripe on open unlinked file/rename victim"
 
+test_27C() { #LU-2871
+       [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
+
+       declare -a ost_idx
+       local index
+       local i
+       local j
+
+       test_mkdir -p $DIR/$tdir
+       cd $DIR/$tdir
+       for i in $(seq 0 $((OSTCOUNT - 1))); do
+               # set stripe across all OSTs starting from OST$i
+               $SETSTRIPE -i $i -c -1 $tfile$i
+               # get striping information
+               ost_idx=($($GETSTRIPE $tfile$i |
+                        tail -n $((OSTCOUNT + 1)) | awk '{print $1}'))
+               echo ${ost_idx[@]}
+               # check the layout
+               for j in $(seq 0 $((OSTCOUNT - 1))); do
+                       index=$(((i + j) % OSTCOUNT))
+                       [ ${ost_idx[$j]} -eq $index ] || error
+               done
+       done
+}
+run_test 27C "check full striping across all OSTs"
+
 # createtest also checks that device nodes are created and
 # then visible correctly (#2091)
 test_28() { # bug 2091
@@ -8417,7 +8444,8 @@ run_test 150 "truncate/append tests"
 
 function roc_hit() {
        local list=$(comma_list $(osts_nodes))
-
+       #debug temp debug for LU-2902: lets see what values we get back
+       echo $(get_osd_param $list '' stats) 1>&2
        echo $(get_osd_param $list '' stats |
               awk '/'cache_hit'/ {sum+=$2} END {print sum}')
 }
@@ -8455,15 +8483,29 @@ test_151() {
 
        set_osd_param $list '' writethrough_cache_enable 1
 
-        # pages should be in the case right after write
-        dd if=/dev/urandom of=$DIR/$tfile bs=4k count=$CPAGES || error "dd failed"
-        local BEFORE=`roc_hit`
-        cancel_lru_locks osc
-        cat $DIR/$tfile >/dev/null
-        local AFTER=`roc_hit`
-        if ! let "AFTER - BEFORE == CPAGES"; then
-                error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
-        fi
+       # check write cache is enabled on all obdfilters
+       if get_osd_param $list '' writethrough_cache_enable | grep 0; then
+               echo "oss write cache is NOT enabled"
+               return 0
+       fi
+
+#define OBD_FAIL_OBD_NO_LRU  0x609
+       do_nodes $list $LCTL set_param fail_loc=0x609
+
+       # pages should be in the case right after write
+       dd if=/dev/urandom of=$DIR/$tfile bs=4k count=$CPAGES ||
+               error "dd failed"
+
+       local BEFORE=`roc_hit`
+       cancel_lru_locks osc
+       cat $DIR/$tfile >/dev/null
+       local AFTER=`roc_hit`
+
+       do_nodes $list $LCTL set_param fail_loc=0
+
+       if ! let "AFTER - BEFORE == CPAGES"; then
+               error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
+       fi
 
         # the following read invalidates the cache
         cancel_lru_locks osc
@@ -9532,7 +9574,8 @@ test_184c() {
        dd if=$ref1 of=$file1 bs=16k &
        local DD_PID=$!
 
-       sleep 0.$((RANDOM % 5 + 1))
+       # Make sure dd starts to copy file
+       while [ ! -f $file1 ]; do sleep 0.1; done
 
        $LFS swap_layouts $file1 $file2
        local rc=$?
@@ -10864,6 +10907,20 @@ test_231b() {
 }
 run_test 231b "must not assert on fully utilized OST request buffer"
 
+test_232() {
+       mkdir -p $DIR/$tdir
+       #define OBD_FAIL_LDLM_OST_LVB            0x31c
+       $LCTL set_param fail_loc=0x31c
+
+       # ignore dd failure
+       dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=1 || true
+
+       $LCTL set_param fail_loc=0
+       umount_client $MOUNT || error "umount failed"
+       mount_client $MOUNT || error "mount failed"
+}
+run_test 232 "failed lock should not block umount"
+
 #
 # tests that do cleanup/setup should be run at the end
 #