Whamcloud - gitweb
LU-7371 test: wrong read length over isize 60/17060/3
authorLi Xi <lixi@ddn.com>
Fri, 6 Nov 2015 09:06:08 +0000 (17:06 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 2 Dec 2015 03:55:16 +0000 (03:55 +0000)
This patch adds tests to check read length is correct if reading
a file of size 4095.

Signed-off-by: Li Xi <lixi@ddn.com>
Change-Id: I0c0f6b378fa4af053ed54f2f5dea2418191a7b69
Reviewed-on: http://review.whamcloud.com/17060
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/include/obd_support.h
lustre/target/tgt_handler.c
lustre/tests/sanity.sh

index b9d36ee..a537840 100644 (file)
@@ -320,6 +320,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
 
 #define OBD_FAIL_LDLM                    0x300
 #define OBD_FAIL_LDLM_NAMESPACE_NEW      0x301
index e65269f..21cecc2 100644 (file)
@@ -1896,6 +1896,9 @@ 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) {
                cksum_type_t cksum_type =
index a73ace6..1ec7f46 100755 (executable)
@@ -13410,6 +13410,19 @@ test_245() {
 }
 run_test 245 "check mdc connection flag/data: multiple modify RPCs"
 
+test_246() { # LU-7371
+       [ $(lustre_version_code ost1) -lt $(version_code 2.7.62) ] &&
+               skip "Need OST version >= 2.7.62" && return 0
+       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"
+
 test_250() {
        [ "$(facet_fstype ost$(($($GETSTRIPE -i $DIR/$tfile) + 1)))" = "zfs" ] \
         && skip "no 16TB file size limit on ZFS" && return