Whamcloud - gitweb
LU-14642 tests: skip sanity-flr/100 for old servers
[fs/lustre-release.git] / lustre / tests / sanity-flr.sh
index c5d4b7d..c268fdc 100644 (file)
@@ -10,12 +10,12 @@ ONLY=${ONLY:-"$*"}
 
 LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
-init_test_env $@
+init_test_env "$@"
 init_logging
 
 ALWAYS_EXCEPT="$SANITY_FLR_EXCEPT "
-# Bug number for skipped test:    LU-14818 LU-11381
-ALWAYS_EXCEPT+="                  6        201 "
+# Bug number for skipped test:    LU-14818 LU-11381 LU-14765
+ALWAYS_EXCEPT+="                  6        201      44c "
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 # skip all tests for PPC until we can get sanity-pfl to pass
@@ -25,7 +25,7 @@ fi
 
 if [[ "$ost1_FSTYPE" == "zfs" ]]; then
        # bug #:        LU-1941
-       ALWAYS_EXCEPT+="49a"
+       ALWAYS_EXCEPT+=" 49a "
 fi
 
 build_test_filter
@@ -1061,9 +1061,6 @@ test_31() {
        $LFS mirror create -N -o 0 -N -o 1 $tf ||
                error "creating mirrored file $tf failed"
 
-       #define OBD_FAIL_GLIMPSE_IMMUTABLE 0x1A00
-       $LCTL set_param fail_loc=0x1A00
-
        local ost_idx
        for ((ost_idx = 1; ost_idx <= 2; ost_idx++)); do
                cancel_lru_locks osc
@@ -1539,7 +1536,7 @@ test_37()
        echo "Verifying mirror read .."
 
        local sum
-       for i in ${mirror_array[@]}; do
+       for i in "${mirror_array[@]}"; do
                $LCTL set_param ldlm.namespaces.*.lru_size=clear > /dev/null
                sum=$($LFS mirror read -N $i $tf | md5sum)
                [ "$sum" = "${checksums[$i]}" ] ||
@@ -1565,7 +1562,7 @@ test_37()
 
        # verify copying is successful by checking checksums
        remount_client $MOUNT
-       for i in ${mirror_array[@]}; do
+       for i in "${mirror_array[@]}"; do
                sum=$($LFS mirror read -N $i $tf | md5sum)
                [ "$sum" = "${checksums[1]}" ] ||
                        error "$i: mismatch checksum after copy \'$sum\'"
@@ -1613,7 +1610,7 @@ test_38() {
        [ "$file_cksum" = "$ref_cksum" ] || error "write failed, cksum mismatch"
 
        get_mirror_ids $tf
-       echo "mirror IDs: ${mirror_array[@]}"
+       echo "mirror IDs: ${mirror_array[*]}"
 
        local valid_mirror stale_mirror id mirror_cksum
        for id in "${mirror_array[@]}"; do
@@ -2173,6 +2170,96 @@ test_44c() {
 }
 run_test 44c "lfs mirror split reduces block size of a file"
 
+test_44d() {
+       local tf=$DIR/$tdir/$tfile
+       local size1
+       local size2
+       local size3
+       local size4
+
+       stack_trap "rm -f $tf"
+
+       mkdir -p $DIR/$tdir || error "create directroy failed"
+
+       dd if=/dev/zero of=$tf bs=1M count=10 || error "dd write $tfile failed"
+       sync
+       size1=$(stat -c "%s" $tf)
+       echo " ** before mirror ops, file size=$size1"
+
+       $LFS mirror extend -N2 -c1 $tf || error "mirror extend $tfile failed"
+       sync
+       size2=$(stat -c "%s" $tf)
+       echo " ** after mirror extend, file size=$size2"
+
+       (($size1 == $size2)) ||
+               error "mirror extend should not change size, before: $size1, after $size2"
+
+       $LFS mirror split -d --mirror-id=2 $tf ||
+               error "mirror split $tfile failed"
+
+       size2=$(stat -c "%s" $tf)
+       echo " ** after mirror split, file size=$size2"
+       (($size1 == $size2)) ||
+               error "mirror split should not change size, before: $size1, after $size2"
+
+       # Remount client to clear cached size information
+       remount_client $MOUNT
+       size2=$(stat -c "%s" $tf)
+       echo " ** after mirror split & remount, file size=$size2"
+       (($size1 == $size2)) ||
+               error "mirror extend should not change size, before: $size1, after $size2"
+
+}
+run_test 44d "lfs mirror split does not break size"
+
+test_44e() {
+       local tf=$DIR/$tdir/$tfile
+       local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+       local size1
+       local size2
+
+       test_mkdir $DIR/$tdir
+       [ $MDS1_VERSION -ge $(version_code 2.14.52) ] ||
+               skip "Need MDS version at least 2.14.52"
+
+       $LFS mirror create -N2 $tf || error "create mirrored file $tf failed"
+
+       # Disable xattr caching so we can repeatedly check SOM with lfs getsom
+       $LCTL set_param llite.*.xattr_cache=0
+       stack_trap "$LCTL set_param llite.*.xattr_cache=1"
+
+       dd if=/dev/zero of=$tf bs=1M count=10 || error "dd write $tfile failed"
+       sync
+       size1=$(stat -c "%s" $tf)
+       echo " ** before mirror resync, file size=$size1"
+
+       $LFS mirror resync $tf || error "mirror resync file $tf failed"
+       size1=$(stat -c "%s" $tf)
+       size2=$($LFS getsom -s $tf)
+
+       $LFS getsom $tf
+
+       ((size1 == size2)) ||
+               error "mirrored file with strict SOM $size1 != disabled SOM $size2"
+
+       # Remount client to clear cached size information
+       remount_client $MOUNT
+
+       save_lustre_params $(get_facets MDS) mdt.*MDT*.enable_strict_som > $p
+       stack_trap "restore_lustre_params < $p; rm -f $p"
+       local mds_facet=mds$(($($LFS getstripe -m $tf) + 1))
+
+       do_facet $mds_facet $LCTL set_param mdt.*MDT*.enable_strict_som=0
+
+       size2=$(stat -c "%s" $tf)
+       # 'getsom' here is just for debugging
+       $LFS getsom $tf
+
+       ((size2 == size1)) ||
+               error "mirrored file in sync with som disabled, size with som disabled ($size2) and without som disabled ($size1) should agree"
+}
+run_test 44e "basic FLR SOM tests + disable SOM"
+
 test_45() {
        [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
 
@@ -2720,8 +2807,8 @@ test_50c() {
 
        if [[ "$FSTYPE" == "ldiskfs" ]]; then
                # ZFS does not support fallocate for now
-               fallocate -p -o 1MiB -l 1MiB $tf ||
-                       error "punch hole in $tf failed"
+               out=$(fallocate -p -o 1MiB -l 1MiB $tf 2>&1) ||
+                       skip_eopnotsupp "$out|punch hole in $tf failed"
                verify_flr_state $tf "wp"
        fi
 
@@ -2760,10 +2847,10 @@ test_50d() {
 
        if [[ $rc -eq 0 ]]; then
                verify_flr_state $file "wp"
-       elif [[ ! $prt =~ "unsupported" ]]; then
+       elif [[ ! $prt =~ unsupported ]]; then
                error "punch hole in $file failed: $prt"
        else
-               skip "Fallocate punch is not supported"
+               skip "Fallocate punch is not supported: $prt"
        fi
 
        echo " ** verify sparseness"
@@ -2900,20 +2987,20 @@ test_61a() { # LU-14508
        echo "mirror merge $tfile-2 to $tfile and test timestamps"
        $LFS mirror extend -N -f $file-2 $file ||
                error "cannot mirror merge $file-2 to $file"
-       check_times_61 $file ${tim[@]}
+       check_times_61 $file "${tim[@]}"
 
        echo "mirror extend $tfile and test timestamps"
        $LFS mirror extend -N -c1 -i1 $file ||
                error "cannot extend mirror $file"
-       check_times_61 $file ${tim[@]}
+       check_times_61 $file "${tim[@]}"
 
        echo "migrate $tfile and test timestamps"
        $LFS migrate -n $file || error "cannot migrate $file"
-       check_times_61 $file ${tim[@]}
+       check_times_61 $file "${tim[@]}"
 
        echo "normal user migrate $tfile and test timestamps"
        $RUNAS $LFS migrate -n $file || error "cannot migrate $file"
-       check_times_61 $file ${tim[@]}
+       check_times_61 $file "${tim[@]}"
 }
 run_test 61a "mirror extend and migrate preserve timestamps"
 
@@ -2943,17 +3030,17 @@ test_61b() { # LU-14508
        echo "mirror extend $tfile and test timestamps"
        $LFS mirror extend -N -c1 -i1 $file ||
                error "cannot extend mirror $file"
-       check_times_61 $file ${tim[@]}
+       check_times_61 $file "${tim[@]}"
 
        echo "mirror split $tfile and test timestamps"
        $LFS mirror split -d --mirror-id=1 $file ||
                error "cannot split mirror 1 off $file"
-       check_times_61 $file ${tim[@]}
+       check_times_61 $file "${tim[@]}"
 
        echo "normal user mirror extend $tfile and test timestamps"
        $RUNAS $LFS mirror extend -N -c1 -i1 $file ||
                error "cannot extend mirror $file"
-       check_times_61 $file ${tim[@]}
+       check_times_61 $file "${tim[@]}"
 }
 run_test 61b "mirror extend and split preserve timestamps"
 
@@ -2981,14 +3068,14 @@ test_61c() { # LU-14508
        tim=( $(get_times_61 $file) )
        sleep $nap
        $LFS mirror resync $file || error "cannot resync mirror $file"
-       check_times_61 $file ${tim[@]}
+       check_times_61 $file "${tim[@]}"
 
        echo XXXXXX > $file || error "write $tfile failed"
 
        echo "normal user resync $tfile and test timestamps"
        tim=( $(get_times_61 $file) )
        $RUNAS $LFS mirror resync $file || error "cannot resync mirror $file"
-       check_times_61 $file ${tim[@]}
+       check_times_61 $file "${tim[@]}"
 }
 run_test 61c "mirror resync preserves timestamps"
 
@@ -3021,6 +3108,23 @@ test_70() {
 }
 run_test 70 "mirror create and split race"
 
+test_100() {
+       local tf=$DIR/$tdir/$tfile
+
+       (( $OST1_VERSION >= $(version_code 2.14.51) )) ||
+               skip "Need OST version at least 2.14.51"
+
+
+       test_mkdir $DIR/$tdir
+
+       $LFS setstripe -N -E1M -c-1 -Eeof -c-1 $tf ||
+               error "setstripe $tf failed"
+
+       FSXNUM=${FSXNUM:-1000}
+       $FSX -p 5 -N $FSXNUM -S 0 -M $tf || error "fsx FLR file $tf failed"
+}
+run_test 100 "flr mode fsx test"
+
 ctrl_file=$(mktemp /tmp/CTRL.XXXXXX)
 lock_file=$(mktemp /var/lock/FLR.XXXXXX)
 
@@ -3141,8 +3245,8 @@ test_200() {
 
        rm -f $ctrl_file
 
-       echo "Waiting ${pids[@]}"
-       wait ${pids[@]}
+       echo "Waiting ${pids[*]}"
+       wait "${pids[@]}"
 
        umount_client $MOUNT2
        umount_client $MOUNT3
@@ -3153,8 +3257,9 @@ test_200() {
        $LFS mirror resync $tf || error "final resync failed"
        get_mirror_ids $tf
 
-       local csum=$($LFS mirror read -N ${mirror_array[0]} $tf | md5sum)
-       for id in ${mirror_array[@]:1}; do
+       local csum=$($LFS mirror read -N "${mirror_array[0]}" $tf | md5sum)
+
+       for id in "${mirror_array[@]:1}"; do
                [ "$($LFS mirror read -N $id $tf | md5sum)" = "$csum" ] ||
                        error "checksum error for mirror $id"
        done
@@ -3258,7 +3363,7 @@ test_203() {
        local new_id=$($LFS getstripe --mirror-id=2 -I $tf)
        count=$($LFS getstripe --mirror-id=2 -c $tf) ||
                error "getstripe count of mirror 2"
-       [[ x$oldid = x$newid ]] ||
+       [[ x$old_id = x$new_id ]] ||
                error "mirror 2 changed ID from $old_id to $new_id"
        [[ x$count = x1 ]] || error "mirror 2 stripe count $count is not 1"
 
@@ -3735,23 +3840,23 @@ test_207() {
        $LFS mirror create -N -S 4M -c 2 -N -S 1M -c -1 $file ||
                error "create mirrored file $file failed"
        get_mirror_ids $file
-       echo "mirror IDs: ${mirror_array[@]}"
+       echo "mirror IDs: ${mirror_array[*]}"
 
        dd if=$tmpfile of=$file bs=1M || error "can't copy"
        get_mirror_ids $file
-       echo "mirror IDs: ${mirror_array[@]}"
+       echo "mirror IDs: ${mirror_array[*]}"
 
        drop_client_cache
        cmp $tmpfile $file || error "files don't match"
        get_mirror_ids $file
-       echo "mirror IDs: ${mirror_array[@]}"
+       echo "mirror IDs: ${mirror_array[*]}"
 
        # mirror creation should work fine
        $LFS mirror extend -N -S 8M -c -1 $file ||
                error "mirror extend $file failed"
 
        get_mirror_ids $file
-       echo "mirror IDs: ${mirror_array[@]}"
+       echo "mirror IDs: ${mirror_array[*]}"
 
        drop_client_cache
        $LFS mirror verify -v $file || error "verification failed"
@@ -3800,7 +3905,7 @@ function check_ost_used() {
                        osc.$FSNAME-OST000$ost-osc-[-0-9a-f]*.stats |
                        awk "/ost_$io/{print \$2}")
                nr=${nr:-0}
-               if [[ " $* " =~ " $ost " ]]; then
+               if [[ " $* " =~ $ost ]]; then
                        (( nr > 0 )) || error "expected reads on $ost"
                else
                        (( nr == 0 )) || error "unexpected $nr reads on $ost"