From: Vladimir Saveliev Date: Wed, 31 Jul 2024 14:20:17 +0000 (+0300) Subject: LU-17567 tests: improve sanity.sh:test_27T X-Git-Tag: 2.15.90~87 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=8a865c65c691358c13bc7f564e952b605d74ea4b;p=fs%2Flustre-release.git LU-17567 tests: improve sanity.sh:test_27T 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 Change-Id: I056145ffc223f943585edbaa70f92ab9d5fdc1f1 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54113 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Nikitas Angelinas Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index b7f4181..5b5deda 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -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 diff --git a/lustre/target/tgt_handler.c b/lustre/target/tgt_handler.c index f706638..2297db5 100644 --- a/lustre/target/tgt_handler.c +++ b/lustre/target/tgt_handler.c @@ -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); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 52d5384..2a40d8d 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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"