Whamcloud - gitweb
LU-11729 obdclass: align to T10 sector size when generating guard 43/34043/11
authorAndreas Dilger <adilger@whamcloud.com>
Wed, 21 Aug 2019 14:03:11 +0000 (10:03 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 16 Sep 2019 23:05:09 +0000 (23:05 +0000)
Otherwise the client and server would come up with
different checksum when the page size is different.

Improve test_810 to verify all available checksum types.

Test-Parameters: trivial envdefinitions=ONLY=810 testlist=sanity,sanity,sanity
Test-Parameters: clientarch=aarch64 envdefinitions=ONLY=810 testlist=sanity,sanity
Test-Parameters: clientarch=ppc64 envdefinitions=ONLY=810 testlist=sanity,sanity
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Change-Id: I24117aebb277d4ddcb7787b715587e33023ebbe5
Reviewed-on: https://review.whamcloud.com/34043
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Arshad Hussain <arshad.super@gmail.com>
lustre/obdclass/integrity.c
lustre/tests/sanity.sh

index 3895545..1d15cd5 100644 (file)
@@ -50,14 +50,15 @@ int obd_page_dif_generate_buffer(const char *obd_name, struct page *page,
                                 int *used_number, int sector_size,
                                 obd_dif_csum_fn *fn)
 {
                                 int *used_number, int sector_size,
                                 obd_dif_csum_fn *fn)
 {
-       unsigned int i;
+       unsigned int i = offset;
+       unsigned int end = offset + length;
        char *data_buf;
        __u16 *guard_buf = guard_start;
        unsigned int data_size;
        int used = 0;
 
        data_buf = kmap(page) + offset;
        char *data_buf;
        __u16 *guard_buf = guard_start;
        unsigned int data_size;
        int used = 0;
 
        data_buf = kmap(page) + offset;
-       for (i = 0; i < length; i += sector_size) {
+       while (i < end) {
                if (used >= guard_number) {
                        CERROR("%s: unexpected used guard number of DIF %u/%u, "
                               "data length %u, sector size %u: rc = %d\n",
                if (used >= guard_number) {
                        CERROR("%s: unexpected used guard number of DIF %u/%u, "
                               "data length %u, sector size %u: rc = %d\n",
@@ -65,12 +66,11 @@ int obd_page_dif_generate_buffer(const char *obd_name, struct page *page,
                               sector_size, -E2BIG);
                        return -E2BIG;
                }
                               sector_size, -E2BIG);
                        return -E2BIG;
                }
-               data_size = length - i;
-               if (data_size > sector_size)
-                       data_size = sector_size;
+               data_size = min(round_up(i + 1, sector_size), end) - i;
                *guard_buf = fn(data_buf, data_size);
                guard_buf++;
                data_buf += data_size;
                *guard_buf = fn(data_buf, data_size);
                guard_buf++;
                data_buf += data_size;
+               i += data_size;
                used++;
        }
        kunmap(page);
                used++;
        }
        kunmap(page);
index cff47e9..9877521 100644 (file)
@@ -53,8 +53,8 @@ fi
 if [[ $(uname -m) = aarch64 ]]; then
        # bug number:    LU-11596
        ALWAYS_EXCEPT+=" $GRANT_CHECK_LIST"
 if [[ $(uname -m) = aarch64 ]]; then
        # bug number:    LU-11596
        ALWAYS_EXCEPT+=" $GRANT_CHECK_LIST"
-       # bug number:    LU-11671 LU-11667 LU-11729 LU-4398
-       ALWAYS_EXCEPT+=" 45       317      810       817"
+       # bug number:    LU-11671 LU-11667 LU-4398
+       ALWAYS_EXCEPT+=" 45       317      817"
 fi
 
 #                                  5          12          (min)"
 fi
 
 #                                  5          12          (min)"
@@ -21746,20 +21746,29 @@ test_809() {
 run_test 809 "Verify no SOM xattr store for DoM-only files"
 
 test_810() {
 run_test 809 "Verify no SOM xattr store for DoM-only files"
 
 test_810() {
-       local ORIG
-       local CSUM
-
-       # t10 seem to dislike partial pages
-       lctl set_param osc.*.checksum_type=adler
-       lctl set_param fail_loc=0x411
-       dd if=/dev/urandom of=$DIR/$tfile bs=10240 count=2
-       ORIG=$(md5sum $DIR/$tfile)
-       lctl set_param ldlm.namespaces.*osc*.lru_size=clear
-       CSUM=$(md5sum $DIR/$tfile)
-       set_checksum_type adler
-       if [ "$ORIG" != "$CSUM" ]; then
-               error "$ORIG != $CSUM"
-       fi
+       [ $PARALLEL == "yes" ] && skip "skip parallel run"
+       $GSS && skip_env "could not run with gss"
+
+       set_checksums 1
+       stack_trap "set_checksums $ORIG_CSUM" EXIT
+       stack_trap "set_checksum_type $ORIG_CSUM_TYPE" EXIT
+
+       local csum
+       local before
+       local after
+       for csum in $CKSUM_TYPES; do
+               #define OBD_FAIL_OSC_NO_GRANT   0x411
+               $LCTL set_param osc.*.checksum_type=$csum fail_loc=0x411
+               for i in "10240 0" "10000 0" "4000 1" "500 1"; do
+                       eval set -- $i
+                       dd if=/dev/urandom of=$DIR/$tfile bs=$1 count=2 seek=$2
+                       before=$(md5sum $DIR/$tfile)
+                       $LCTL set_param ldlm.namespaces.*osc*.lru_size=clear
+                       after=$(md5sum $DIR/$tfile)
+                       [ "$before" == "$after" ] ||
+                               error "$csum: $before != $after bs=$1 seek=$2"
+               done
+       done
 }
 run_test 810 "partial page writes on ZFS (LU-11663)"
 
 }
 run_test 810 "partial page writes on ZFS (LU-11663)"