summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2007-05-01 12:09:45 +0000
committerpjd <pjd@FreeBSD.org>2007-05-01 12:09:45 +0000
commitf7ee62e6ccc3d3d94b57bcf1504514a4a79e53d9 (patch)
tree669a83dcc0273aa68fbed0dc55826c5984aae971
parent56848683c4329b4d2b66234a1a82d03aad77c811 (diff)
downloadFreeBSD-src-f7ee62e6ccc3d3d94b57bcf1504514a4a79e53d9.zip
FreeBSD-src-f7ee62e6ccc3d3d94b57bcf1504514a4a79e53d9.tar.gz
Add a comment explaining why we call dmu_write() unconditionally, even if
uiomove() fails, especially that it is different from what OpenSolaris does (I'm not entirely sure they are right). Suggested by: darrenr
-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 5888e06..288bf9a 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 5888e06..288bf9a 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);
OpenPOWER on IntegriCloud