From: Alex Zhuravlev Date: Tue, 27 Nov 2018 06:47:50 +0000 (+0300) Subject: LU-11663 osd-zfs: write partial pages with correct offset X-Git-Tag: 2.10.6-RC3~1 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=18d6b8fb2c359431a6da57b178ec0845925ea89c;p=fs%2Flustre-release.git LU-11663 osd-zfs: write partial pages with correct offset otherwise non-aligned writes send wrong data to ZFS. Lustre-change: https://review.whamcloud.com/33726 Lustre-commit: 6f9a0292eacb0d603b14cc03290a574cb7f0c846 Change-Id: I1ae1f361981d548307d74344a5694f3ef39c0609 Signed-off-by: Alex Zhuravlev Signed-off-by: Oleg Drokin Reviewed-on: https://review.whamcloud.com/33748 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Hongchao Zhang Reviewed-by: Andreas Dilger --- diff --git a/lustre/osd-zfs/osd_io.c b/lustre/osd-zfs/osd_io.c index 38cc15f..6cf1e8c 100644 --- a/lustre/osd-zfs/osd_io.c +++ b/lustre/osd-zfs/osd_io.c @@ -823,8 +823,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; } else if (lnb[i].lnb_data) { diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 5ba0434..47cf6a1 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -17019,6 +17019,21 @@ test_805() { } run_test 805 "ZFS can remove from full fs" +test_810() { + local ORIG + local CSUM + + 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) + 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 #