Whamcloud - gitweb
LU-15551 ofd: Return EOPNOTSUPP instead of EPROTO 16/46516/13
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Mon, 14 Feb 2022 10:02:08 +0000 (15:32 +0530)
committerOleg Drokin <green@whamcloud.com>
Fri, 18 Mar 2022 17:35:08 +0000 (17:35 +0000)
Modify server to return -EOPNOTSUPP instead of
-EPROTO for unsupported fallocate modes

Test-Parameters: serverversion=2.14.0 testlist=sanity env=ONLY=150
Test-Parameters: serverversion=2.14.0 testlist=sanity-flr env=ONLY=50
Test-Parameters: serverversion=2.14.0 testlist=ost-pools env=ONLY="29 31"
Test-Parameters: serverversion=2.14.0 testlist=sanity-benchmark env=ONLY=fsx
Test-Parameters: serverversion=2.14.0 testlist=sanity-dom env=ONLY=fsx
Test-Parameters: serverversion=2.14.0 testlist=sanityn env=ONLY=16
Fixes: 7462e8cad730 ("LU-14160 fallocate: Add punch mode to fallocate")
Signed-off-by: arshad.hussain@aeoncomputing.com
Change-Id: Id203c0b9abbdd674af33f1f78e81ae7fe105e90f
Reviewed-on: https://review.whamcloud.com/46516
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: Oleg Drokin <green@whamcloud.com>
lustre/ofd/ofd_dev.c
lustre/tests/sanity-flr.sh
lustre/tests/sanity.sh
lustre/tests/test-framework.sh

index c0914a6..7fcb5ac 100644 (file)
@@ -1987,10 +1987,12 @@ static int ofd_fallocate_hdl(struct tgt_session_info *tsi)
        /*
         * fallocate start and end are passed in o_size, o_blocks
         * on the wire.
+        * Return -EOPNOTSUPP to also handle older clients not
+        * supporting newer server modes
         */
        if ((oa->o_valid & (OBD_MD_FLSIZE | OBD_MD_FLBLOCKS)) !=
            (OBD_MD_FLSIZE | OBD_MD_FLBLOCKS))
-               RETURN(err_serious(-EPROTO));
+               RETURN(-EOPNOTSUPP);
 
        start = oa->o_size;
        end = oa->o_blocks;
index c5d4b7d..f39bdc2 100644 (file)
@@ -2720,8 +2720,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
 
@@ -2763,7 +2763,7 @@ test_50d() {
        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"
index 22fde7f..a437b57 100755 (executable)
@@ -14647,7 +14647,7 @@ test_150b() {
 
        touch $DIR/$tfile
        stack_trap "rm -f $DIR/$tfile; wait_delete_completed"
-       check_fallocate $DIR/$tfile || error "fallocate failed"
+       check_fallocate $DIR/$tfile || skip_eopnotsupp "fallocate failed"
 }
 run_test 150b "Verify fallocate (prealloc) functionality"
 
@@ -14697,8 +14697,7 @@ test_150c() {
 
        $LFS setstripe -E1M $striping -E16M -c3 -Eeof -c 4 $DIR/$tfile ||
                error "Create $DIR/$tfile failed"
-       fallocate -l $((1048576 * 512)) $DIR/$tfile ||
-                       error "fallocate failed"
+       fallocate -l $((1048576 * 512)) $DIR/$tfile || error "fallocate failed"
        bytes=$(($(stat -c '%b * %B' $DIR/$tfile)))
        want=$((512 * 1048576))
 
@@ -14802,8 +14801,8 @@ test_150f() {
                error "dd failed for bs 4096 and count 5"
 
        # Call fallocate with punch range which is within the file range
-       fallocate -p --offset 4096 -l $length $DIR/$tfile ||
-               error "fallocate failed: offset 4096 and length $length"
+       out=$(fallocate -p --offset 4096 -l $length $DIR/$tfile 2>&1) ||
+               skip_eopnotsupp "$out|fallocate: offset 4096 and length $length"
        # client must see changes immediately after fallocate
        size=$(stat -c '%s' $DIR/$tfile)
        blocks=$(stat -c '%b' $DIR/$tfile)
@@ -14833,8 +14832,8 @@ test_150f() {
        want_blocks_after=40  # 512 sized blocks
 
        # Punch overlaps two blocks and less than blocksize
-       fallocate -p --offset 4000 -l 3000 $DIR/$tfile ||
-               error "fallocate failed: offset 4000 length 3000"
+       out=$(fallocate -p --offset 4000 -l 3000 $DIR/$tfile 2>&1) ||
+               skip_eopnotsupp "$out|fallocate: offset 4000 length 3000"
        size=$(stat -c '%s' $DIR/$tfile)
        blocks=$(stat -c '%b' $DIR/$tfile)
 
@@ -14918,8 +14917,8 @@ test_150g() {
        # Call fallocate to punch all except 2 blocks. We leave the
        # first and the last block
        echo "fallocate -p --offset $BS -l $punch_size $DIR/$tfile"
-       fallocate -p --offset $BS -l $punch_size $DIR/$tfile ||
-               error "fallocate failed: offset $BS length $punch_size"
+       out=$(fallocate -p --offset $BS -l $punch_size $DIR/$tfile 2>&1) ||
+               skip_eopnotsupp "$out|fallocate: offset $BS length $punch_size"
 
        size_after=$(stat -c '%s' $DIR/$tfile)
        blocks_after=$(stat -c '%b' $DIR/$tfile)
index abc2222..25eb353 100755 (executable)
@@ -6451,6 +6451,19 @@ skip() {
        exit 0
 }
 
+#
+# For interop testing treate EOPNOTSUPP as success
+# and skip
+#
+skip_eopnotsupp() {
+       local retstr=$@
+
+       echo $retstr | awk -F'|' '{print $1}' |
+               grep -E unsupported\|"(Operation not supported)"
+       (( $? == 0 )) || error "$retstr"
+       skip $retstr
+}
+
 build_test_filter() {
        EXCEPT="$EXCEPT $(testslist_filter)"