Whamcloud - gitweb
LU-12275 osd: make osd layer always send complete pages 38/36238/7
authorSebastien Buisson <sbuisson@ddn.com>
Thu, 19 Sep 2019 17:24:49 +0000 (19:24 +0200)
committerOleg Drokin <green@whamcloud.com>
Fri, 6 Dec 2019 01:07:17 +0000 (01:07 +0000)
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 <sbuisson@ddn.com>
Change-Id: I03dc6037a8dfa1d40d40a4b1f675e047d862d933
Reviewed-on: https://review.whamcloud.com/36238
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Patrick Farrell <farr0186@gmail.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
lustre/include/obd_support.h
lustre/osd-ldiskfs/osd_io.c
lustre/osd-zfs/osd_io.c
lustre/target/tgt_handler.c
lustre/tests/sanity.sh

index b71fc45..2f8f802 100644 (file)
@@ -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_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
 #define OBD_FAIL_OST_LADVISE_NET        0x235
 #define OBD_FAIL_OST_PAUSE_PUNCH         0x236
 #define OBD_FAIL_OST_LADVISE_PAUSE      0x237
index b7a55ce..2164421 100644 (file)
@@ -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;
 
                         * 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))
 
                /* Bypass disk read if fail_loc is set properly */
                if (OBD_FAIL_CHECK(OBD_FAIL_OST_FAKE_RW))
index ccb6d68..58c8b30 100644 (file)
@@ -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) {
                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;
                        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)
 
                        /* all subsequent rc should be 0 */
                        while (++i < npages)
index ca5eb97..76ebeac 100644 (file)
@@ -2281,9 +2281,6 @@ int tgt_brw_read(struct tgt_session_info *tsi)
                        break;
                }
        }
                        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 ?
 
        if (body->oa.o_valid & OBD_MD_FLCKSUM) {
                u32 flag = body->oa.o_valid & OBD_MD_FLFLAGS ?
index 0bdc2f5..63a86c3 100644 (file)
@@ -17330,21 +17330,6 @@ test_245() {
 }
 run_test 245 "check mdc connection flag/data: multiple modify RPCs"
 
 }
 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
 
 cleanup_247() {
        local submount=$1