summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2007-05-01 12:09:45 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2007-05-01 12:09:45 +0000
commit7555fddd8339c8692909819d3f4d73b45aa06715 (patch)
tree669a83dcc0273aa68fbed0dc55826c5984aae971
parente3b78ec974ec6d1482fe6170813646c88b489034 (diff)
Notes
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c9
-rw-r--r--sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c9
2 files changed, 18 insertions, 0 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
index 5888e06c4ee8..288bf9a9310d 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
@@ -327,6 +327,15 @@ again:
va = (caddr_t)sf_buf_kva(sf);
woff = uio->uio_loffset - off;
error = uiomove(va + off, bytes, UIO_WRITE, uio);
+ /*
+ * The uiomove() above could have been partially
+ * successful, that's why we call dmu_write()
+ * below unconditionally. The page was marked
+ * non-dirty above and we would lose the changes
+ * without doing so. If the uiomove() failed
+ * entirely, well, we just write what we got
+ * before one more time.
+ */
dmu_write(os, zp->z_id, woff,
MIN(PAGESIZE, fsize - woff), va, tx);
sf_buf_free(sf);
diff --git a/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
index 5888e06c4ee8..288bf9a9310d 100644
--- a/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
+++ b/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
@@ -327,6 +327,15 @@ again:
va = (caddr_t)sf_buf_kva(sf);
woff = uio->uio_loffset - off;
error = uiomove(va + off, bytes, UIO_WRITE, uio);
+ /*
+ * The uiomove() above could have been partially
+ * successful, that's why we call dmu_write()
+ * below unconditionally. The page was marked
+ * non-dirty above and we would lose the changes
+ * without doing so. If the uiomove() failed
+ * entirely, well, we just write what we got
+ * before one more time.
+ */
dmu_write(os, zp->z_id, woff,
MIN(PAGESIZE, fsize - woff), va, tx);
sf_buf_free(sf);