Whamcloud - gitweb
LU-2469 test: Skip failing ZFS tests
[fs/lustre-release.git] / lustre / tests / sanityn.sh
index d79f038..269e371 100644 (file)
@@ -11,9 +11,6 @@ ALWAYS_EXCEPT="                14b  18c     19         22    28   29          35
 grep -q 'Enterprise Server 10' /etc/SuSE-release 2> /dev/null &&
        ALWAYS_EXCEPT="$ALWAYS_EXCEPT 11    14" || true
 
-# Tests that fail on uml
-[ "$UML" = "true" ] && EXCEPT="$EXCEPT 7"
-
 # It will be ported soon.
 EXCEPT="$EXCEPT 22"
 
@@ -43,6 +40,10 @@ init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
+[ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
+# bug number for skipped test:        LU-2840 LU-2776
+       ALWAYS_EXCEPT="$ALWAYS_EXCEPT 21      51a"
+
 [ "$SLOW" = "no" ] && EXCEPT_SLOW="12 23 33a"
 
 FAIL_ON_ERROR=false
@@ -428,14 +429,14 @@ test_19() { # bug3811
        local node=$(facet_active_host ost1)
 
        # check whether obdfilter is cache capable at all
-       if ! get_obdfilter_param $node '' read_cache_enable >/dev/null; then
+       if ! get_osd_param $node '' read_cache_enable >/dev/null; then
                echo "not cache-capable obdfilter"
                return 0
        fi
 
-       local MAX=$(get_obdfilter_param $node '' readcache_max_filesize | \
+       local MAX=$(get_osd_param $node '' readcache_max_filesize | \
                    head -n 1)
-       set_obdfilter_param $node '' readcache_max_filesize 4096
+       set_osd_param $node '' readcache_max_filesize 4096
        dd if=/dev/urandom of=$TMP/$tfile bs=512k count=32
        local SUM=$(cksum $TMP/$tfile | cut -d" " -f 1,2)
        cp $TMP/$tfile $DIR1/$tfile
@@ -450,7 +451,7 @@ test_19() { # bug3811
                [ "$(cat $TMP/sum2)" = "$SUM" ] || \
                        error "$DIR2/$tfile $(cat $TMP/sum2) != $SUM"
        done
-       set_obdfilter_param $node '' readcache_max_filesize $MAX
+       set_osd_param $node '' readcache_max_filesize $MAX
        rm $DIR1/$tfile
 }
 run_test 19 "test concurrent uncached read races ==============="
@@ -960,10 +961,21 @@ get_ost_lock_timeouts() {
     echo $locks
 }
 
+cleanup_34() {
+       local i
+       trap 0
+       do_nodes $(comma_list $(osts_nodes)) \
+               "lctl set_param -n fail_loc=0 2>/dev/null || true"
+       for i in $(seq $OSTCOUNT); do
+               wait_osc_import_state client ost$i FULL
+       done
+}
+
 test_34() { #16129
         local OPER
         local lock_in
         local lock_out
+       trap cleanup_34 EXIT RETURN
         for OPER in notimeout timeout ; do
                 rm $DIR1/$tfile 2>/dev/null
                 lock_in=$(get_ost_lock_timeouts)
@@ -1002,6 +1014,7 @@ test_34() { #16129
                         fi
                 fi
         done
+       cleanup_34
 }
 run_test 34 "no lock timeout under IO"
 
@@ -1970,7 +1983,7 @@ test_45g() {
        mv $DIR1/$tfile $DIR1/$tfile-2 &
        PID1=$!
        sleep 1
-       stat $DIR2/$tfile > /dev/null && "stat must fail"
+       stat $DIR2/$tfile > /dev/null && error "stat must fail"
        check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
        rm -r $DIR1/*
        return 0
@@ -2258,6 +2271,81 @@ test_50() {
 }
 run_test 50 "osc lvb attrs: enqueue vs. CP AST =============="
 
+test_51a() {
+       local filesize
+       local origfile=/etc/hosts
+
+       filesize=`stat -c %s $origfile`
+
+       # create an empty file
+       $MCREATE $DIR1/$tfile
+       # cache layout lock on both mount point
+       stat $DIR1/$tfile > /dev/null
+       stat $DIR2/$tfile > /dev/null
+
+       # open and sleep 2 seconds then read
+       $MULTIOP $DIR2/$tfile o_2r${filesize}c &
+       local pid=$!
+       sleep 0.1
+
+       # create the layout of testing file
+       dd if=$origfile of=$DIR1/$tfile conv=notrunc > /dev/null
+
+       # MULTIOP proc should be able to read enough bytes and exit
+       sleep 2
+       kill -0 $pid && error "multiop is still there"
+       cmp $origfile $DIR2/$tfile || error "$MCREATE and $DIR2/$tfile differs"
+
+       rm -f $DIR1/$tfile
+}
+run_test 51a "layout lock: refresh layout should work"
+
+test_51b() {
+       local tmpfile=`mktemp`
+
+       # create an empty file
+       $MCREATE $DIR1/$tfile
+
+       # delay glimpse so that layout has changed when glimpse finish
+#define OBD_FAIL_GLIMPSE_DELAY 0x1404
+       $LCTL set_param fail_loc=0x1404
+       stat -c %s $DIR2/$tfile |tee $tmpfile &
+       local pid=$!
+       sleep 0.1
+
+       # create layout of testing file
+       dd if=/dev/zero of=$DIR1/$tfile bs=1k count=1 conv=notrunc > /dev/null
+
+       wait $pid
+       local fsize=`cat $tmpfile`
+
+       [ x$fsize = x1024 ] || error "file size is $fsize, should be 1024"
+
+       rm -f $DIR1/$tfile $tmpfile
+}
+run_test 51b "layout lock: glimpse should be able to restart if layout changed"
+
+test_51c() {
+       # create an empty file
+       $MCREATE $DIR1/$tfile
+
+#define OBD_FAIL_MDS_LL_BLOCK 0x172
+       $LCTL set_param fail_loc=0x172
+
+       # change the layout of testing file
+       echo "Setting layout ..."
+       $LFS setstripe -c $OSTCOUNT $DIR1/$tfile &
+       pid=$!
+       sleep 0.1
+
+       # get layout of this file should wait until dd is finished
+       local stripecnt=`$LFS getstripe -c $DIR2/$tfile`
+       [ $stripecnt -eq $OSTCOUNT ] || error "layout wrong"
+
+       rm -f $DIR1/$tfile
+}
+run_test 51c "layout lock: IT_LAYOUT blocked and correct layout can be returned"
+
 test_60() {
        [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.3.0) ]] ||
        { skip "Need MDS version at least 2.3.0"; return; }