Whamcloud - gitweb
LU-11663 osd-zfs: write partial pages with correct offset 26/33726/4
authorAlex Zhuravlev <bzzz@whamcloud.com>
Tue, 27 Nov 2018 06:47:50 +0000 (09:47 +0300)
committerOleg Drokin <green@whamcloud.com>
Fri, 30 Nov 2018 18:28:53 +0000 (18:28 +0000)
otherwise non-aligned writes send wrong data to ZFS.

Change-Id: I1ae1f361981d548307d74344a5694f3ef39c0609
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/33726
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osd-zfs/osd_io.c
lustre/tests/sanity.sh

index a8bbd6b..b836536 100644 (file)
@@ -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,
 
                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 */
                        kunmap(lnb[i].lnb_page);
                        iosize += lnb[i].lnb_len;
                        abufsz = lnb[i].lnb_len; /* to drop cache below */
index 3c7e54e..500d660 100755 (executable)
@@ -20021,6 +20021,24 @@ test_809() {
 }
 run_test 809 "Verify no SOM xattr store for DoM-only files"
 
 }
 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
 #
 #
 # tests that do cleanup/setup should be run at the end
 #