From c038909fbc2b3b14763dd731e9c877d11d338f04 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Tue, 27 Nov 2018 09:47:50 +0300 Subject: [PATCH 1/1] LU-11663 osd-zfs: write partial pages with correct offset otherwise non-aligned writes send wrong data to ZFS. Change-Id: I1ae1f361981d548307d74344a5694f3ef39c0609 Signed-off-by: Alex Zhuravlev Reviewed-on: https://review.whamcloud.com/33726 Reviewed-by: Andreas Dilger Reviewed-by: Patrick Farrell Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/osd-zfs/osd_io.c | 4 ++-- lustre/tests/sanity.sh | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lustre/osd-zfs/osd_io.c b/lustre/osd-zfs/osd_io.c index a8bbd6b..b836536 100644 --- a/lustre/osd-zfs/osd_io.c +++ b/lustre/osd-zfs/osd_io.c @@ -881,8 +881,8 @@ static int osd_write_commit(const struct lu_env *env, struct dt_object *dt, if (lnb[i].lnb_page->mapping == (void *)obj) { osd_dmu_write(osd, obj->oo_dn, lnb[i].lnb_file_offset, - lnb[i].lnb_len, kmap(lnb[i].lnb_page), - oh->ot_tx); + lnb[i].lnb_len, kmap(lnb[i].lnb_page) + + lnb[i].lnb_page_offset, oh->ot_tx); kunmap(lnb[i].lnb_page); iosize += lnb[i].lnb_len; abufsz = lnb[i].lnb_len; /* to drop cache below */ diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 3c7e54e..500d660 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -20021,6 +20021,24 @@ 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 +} +run_test 810 "partial page writes on ZFS (LU-11663)" + # # tests that do cleanup/setup should be run at the end # -- 1.8.3.1