Whamcloud - gitweb
LU-17567 tests: improve sanity.sh:test_27T 13/54113/3
authorVladimir Saveliev <vladimir.saveliev@hpe.com>
Wed, 31 Jul 2024 14:20:17 +0000 (17:20 +0300)
committerOleg Drokin <green@whamcloud.com>
Fri, 16 Aug 2024 23:51:19 +0000 (23:51 +0000)
sanity.sh:test_27T is to take care that second of write rpcs generated
by multiop fails with ENOSPC. Otherwise, grant accounting breaks.

Test-Parameters: testlist=sanity env=ONLY="27T 42d"
HPE-bug-id: LUS-11178
Signed-off-by: Vladimir Saveliev <vladimir.saveliev@hpe.com>
Change-Id: I056145ffc223f943585edbaa70f92ab9d5fdc1f1
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54113
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Nikitas Angelinas <nikitas.angelinas@hpe.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/obd_support.h
lustre/target/tgt_handler.c
lustre/tests/sanity.sh

index b7f4181..5b5deda 100644 (file)
@@ -365,6 +365,7 @@ extern bool obd_enable_health_write;
 #define OBD_FAIL_OST_RESTART_IO                 0x251
 #define OBD_FAIL_OST_OPCODE             0x253
 #define OBD_FAIL_OST_DELORPHAN_DELAY    0x254
+#define OBD_FAIL_OST_ENOSPC_VALID       0x255
 
 #define OBD_FAIL_LDLM                    0x300
 #define OBD_FAIL_LDLM_NAMESPACE_NEW      0x301
index f706638..2297db5 100644 (file)
@@ -2750,6 +2750,12 @@ int tgt_brw_write(struct tgt_session_info *tsi)
            ptlrpc_connection_is_local(exp->exp_connection))
                mpflags = memalloc_noreclaim_save();
 
+       /* it is incorrect to return ENOSPC when granted space has been used */
+       if (unlikely(!(remote_nb[0].rnb_flags & OBD_BRW_FROM_GRANT))) {
+               if (CFS_FAIL_CHECK(OBD_FAIL_OST_ENOSPC_VALID))
+                       RETURN(err_serious(-ENOSPC));
+       }
+
        req_capsule_set_size(&req->rq_pill, &RMF_RCS, RCL_SERVER,
                             niocount * sizeof(*rcs));
        rc = req_capsule_server_pack(&req->rq_pill);
index 52d5384..2a40d8d 100755 (executable)
@@ -3530,10 +3530,13 @@ test_27T() {
        [ $(facet_host client) == $(facet_host ost1) ] &&
                skip "need ost1 and client on different nodes"
 
-#define OBD_FAIL_OSC_NO_GRANT            0x411
-       $LCTL set_param fail_loc=0x20000411 fail_val=1
-#define OBD_FAIL_OST_ENOSPC              0x215
-       do_facet ost1 "$LCTL set_param fail_loc=0x80000215"
+       # CFS_FAIL_ONCE is needed to get cfs_fail_count reset
+       #define OBD_FAIL_OSC_NO_GRANT            0x411
+       #define CFS_FAIL_SKIP                    0x20000000
+       #define CFS_FAIL_ONCE                    0x80000000
+       $LCTL set_param fail_loc=0xa0000411 fail_val=1
+       #define OBD_FAIL_OST_ENOSPC_VALID        0x255
+       do_facet ost1 "$LCTL set_param fail_loc=0x80000255"
        $LFS setstripe -i 0 -c 1 $DIR/$tfile
        # DIO does not support partial writes to a single stripe - a write to
        # each stripe will fail or succeed entirely.  So we disable hybrid IO
@@ -3541,8 +3544,17 @@ test_27T() {
        local hybrid=$($LCTL get_param -n llite.*.hybrid_io)
        $LCTL set_param llite.*.hybrid_io=0
        stack_trap "$LCTL set_param -n llite.*.hybrid_io=$hybrid" EXIT
-       $MULTIOP $DIR/$tfile oO_WRONLY:P$((4 * 1024 * 1024 + 10 * 4096))c ||
+
+       local pagesz=$(getconf PAGESIZE)
+       local pagenr=$($LCTL get_param -n osc.*-OST0000-*.max_pages_per_rpc)
+
+       $MULTIOP $DIR/$tfile oO_WRONLY:P$(((pagenr + 10) * pagesz))c ||
                error "multiop failed"
+       (( $(stat -c '%s' $DIR/$tfile) == pagenr * pagesz )) ||
+               error "wrong size"
+
+       # this is to reset cfs_fail_count and to clear ar_force_sync flags
+       $MULTIOP $DIR/$tfile oO_WRONLY:w${pagesz}c
 }
 run_test 27T "no eio on close on partial write due to enosp"