From: Andreas Dilger Date: Wed, 21 Aug 2019 14:03:11 +0000 (-0400) Subject: LU-11729 obdclass: align to T10 sector size when generating guard X-Git-Tag: 2.12.90~132 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=98ceaf854bb4738305769c5cd1df556ee99aa859 LU-11729 obdclass: align to T10 sector size when generating guard 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 Signed-off-by: Li Xi Signed-off-by: Li Dongyang Change-Id: I24117aebb277d4ddcb7787b715587e33023ebbe5 Reviewed-on: https://review.whamcloud.com/34043 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Arshad Hussain --- diff --git a/lustre/obdclass/integrity.c b/lustre/obdclass/integrity.c index 3895545..1d15cd5 100644 --- a/lustre/obdclass/integrity.c +++ b/lustre/obdclass/integrity.c @@ -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); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index cff47e9..9877521 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -53,8 +53,8 @@ fi 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)" @@ -21746,20 +21746,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)"