From 80327de9d7812848a76263033a07823f51023093 Mon Sep 17 00:00:00 2001 From: Artem Blagodarenko Date: Fri, 5 Apr 2024 14:03:56 +0100 Subject: [PATCH] EX-9523 csdc: fix ofd_preprw_write() for sanity 819b test Sanity 819b asserts: tgt_brw_write()) ASSERTION( npages_local == npages_remote ) The test triggers fault inject in ofd_preprw_write(): if (OBD_FAIL_CHECK(OBD_FAIL_OST_2BIG_NIOBUF)) rnb[i].rnb_len += PAGE_SIZE; ofd_preprw_write() calculates npages_local taking in account additional len from fault inject, BUT npages_remote is calulated BEFORE the fault inject. So npages_remote was not adjusted. To solve the problem it is enough to move range_to_page_count() call. Signed-off-by: Artem Blagodarenko Fixes: 217341228f ("EX-7601 tgt: add remote_pages for writes") Change-Id: Ifd659985a78c7630049a17622aff2eb7f4525fb1 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54681 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/target/tgt_handler.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lustre/target/tgt_handler.c b/lustre/target/tgt_handler.c index b59ffb9..54f87b7 100644 --- a/lustre/target/tgt_handler.c +++ b/lustre/target/tgt_handler.c @@ -3065,9 +3065,6 @@ int tgt_brw_write(struct tgt_session_info *tsi) repbody->oa = body->oa; npages_local = PTLRPC_MAX_BRW_PAGES; - for (i = 0; i < niocount; i++) - npages_remote += range_to_page_count(remote_nb[i].rnb_offset, - remote_nb[i].rnb_len); kstart = ktime_get(); rc = obd_preprw(tsi->tsi_env, OBD_BRW_WRITE, exp, &repbody->oa, objcount, ioo, remote_nb, &npages_local, local_write_nb, @@ -3075,6 +3072,10 @@ int tgt_brw_write(struct tgt_session_info *tsi) if (rc < 0) GOTO(out_lock, rc); + for (i = 0; i < niocount; i++) + npages_remote += range_to_page_count(remote_nb[i].rnb_offset, + remote_nb[i].rnb_len); + if (compr_type == LL_COMPR_TYPE_NONE) { /* if there's no compression, the local page count should be * identical to that requested by the client -- 1.8.3.1