Whamcloud - gitweb
LU-11729 obdclass: align to T10 sector size when generating guard 05/36205/2
authorAndreas Dilger <adilger@whamcloud.com>
Wed, 21 Aug 2019 14:03:11 +0000 (10:03 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 23 Sep 2019 08:43:53 +0000 (08:43 +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

Lustre-change: https://review.whamcloud.com/34043
Lustre-commit: 98ceaf854bb4738305769c5cd1df556ee99aa859

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-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Arshad Hussain <arshad.super@gmail.com>
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/36205
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/obdclass/integrity.c
lustre/tests/sanity.sh

index e6d6d85..4a6d27a 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)
 {
-       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;
-       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",
@@ -65,12 +66,11 @@ int obd_page_dif_generate_buffer(const char *obd_name, struct page *page,
                               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;
+               i += data_size;
                used++;
        }
        kunmap(page);
index f7f6339..c3a2aeb 100755 (executable)
@@ -20411,20 +20411,29 @@ test_809() {
 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)"