From: Sebastien Buisson Date: Thu, 19 Sep 2019 17:24:49 +0000 (+0200) Subject: LU-12275 osd: make osd layer always send complete pages X-Git-Tag: 2.13.51~150 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=7b136af8f46024fd48a773e5a79b817bca05d9e8 LU-12275 osd: make osd layer always send complete pages In osd layer, instead of looking if we go beyong isize, just make sure we send complete pages all the time. Data in page beyond isize will be discared by client anyway, and it should not be harmful to send at max PAGE_SIZE-1 more bytes for reads at end of file. With this new paradigm, we need to remove sanity test_246, as its sole purpose is to actually make sure we do not send more than isize bytes to the client. Signed-off-by: Sebastien Buisson Change-Id: I03dc6037a8dfa1d40d40a4b1f675e047d862d933 Reviewed-on: https://review.whamcloud.com/36238 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Patrick Farrell Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Reviewed-by: Li Xi --- diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index b71fc45..2f8f802 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -335,7 +335,7 @@ extern char obd_jobid_var[]; #define OBD_FAIL_OST_STATFS_EINPROGRESS 0x231 #define OBD_FAIL_OST_SET_INFO_NET 0x232 #define OBD_FAIL_OST_NODESTROY 0x233 -#define OBD_FAIL_OST_READ_SIZE 0x234 +/* OBD_FAIL_OST_READ_SIZE 0x234 obsolete since 2.14 */ #define OBD_FAIL_OST_LADVISE_NET 0x235 #define OBD_FAIL_OST_PAUSE_PUNCH 0x236 #define OBD_FAIL_OST_LADVISE_PAUSE 0x237 diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c index b7a55ce..2164421 100644 --- a/lustre/osd-ldiskfs/osd_io.c +++ b/lustre/osd-ldiskfs/osd_io.c @@ -1363,10 +1363,10 @@ static int osd_read_prep(const struct lu_env *env, struct dt_object *dt, * lnb->lnb_rc == 0, so it's easy to detect later. */ break; - if (isize < lnb[i].lnb_file_offset + lnb[i].lnb_len) - lnb[i].lnb_rc = isize - lnb[i].lnb_file_offset; - else - lnb[i].lnb_rc = lnb[i].lnb_len; + /* instead of looking if we go beyong isize, send complete + * pages all the time + */ + lnb[i].lnb_rc = lnb[i].lnb_len; /* Bypass disk read if fail_loc is set properly */ if (OBD_FAIL_CHECK(OBD_FAIL_OST_FAKE_RW)) diff --git a/lustre/osd-zfs/osd_io.c b/lustre/osd-zfs/osd_io.c index ccb6d68..58c8b30 100644 --- a/lustre/osd-zfs/osd_io.c +++ b/lustre/osd-zfs/osd_io.c @@ -986,10 +986,9 @@ static int osd_read_prep(const struct lu_env *env, struct dt_object *dt, lnb[i].lnb_rc = lnb[i].lnb_len; if (lnb[i].lnb_file_offset + lnb[i].lnb_len >= eof) { + /* send complete pages all the time */ if (eof <= lnb[i].lnb_file_offset) lnb[i].lnb_rc = 0; - else - lnb[i].lnb_rc = eof - lnb[i].lnb_file_offset; /* all subsequent rc should be 0 */ while (++i < npages) diff --git a/lustre/target/tgt_handler.c b/lustre/target/tgt_handler.c index ca5eb97..76ebeac 100644 --- a/lustre/target/tgt_handler.c +++ b/lustre/target/tgt_handler.c @@ -2281,9 +2281,6 @@ int tgt_brw_read(struct tgt_session_info *tsi) break; } } - if (OBD_FAIL_CHECK(OBD_FAIL_OST_READ_SIZE) && - nob != cfs_fail_val) - rc = -E2BIG; if (body->oa.o_valid & OBD_MD_FLCKSUM) { u32 flag = body->oa.o_valid & OBD_MD_FLFLAGS ? diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 0bdc2f5..63a86c3 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -17330,21 +17330,6 @@ test_245() { } run_test 245 "check mdc connection flag/data: multiple modify RPCs" -test_246() { # LU-7371 - remote_ost_nodsh && skip "remote OST with nodsh" - [ $OST1_VERSION -lt $(version_code 2.7.62) ] && - skip "Need OST version >= 2.7.62" - - do_facet ost1 $LCTL set_param fail_val=4095 -#define OBD_FAIL_OST_READ_SIZE 0x234 - do_facet ost1 $LCTL set_param fail_loc=0x234 - $LFS setstripe $DIR/$tfile -i 0 -c 1 - dd if=/dev/zero of=$DIR/$tfile bs=4095 count=1 > /dev/null 2>&1 - cancel_lru_locks $FSNAME-OST0000 - dd if=$DIR/$tfile of=/dev/null bs=1048576 || error "Read failed" -} -run_test 246 "Read file of size 4095 should return right length" - cleanup_247() { local submount=$1