diff options
author | pjd <pjd@FreeBSD.org> | 2007-05-01 12:09:45 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2007-05-01 12:09:45 +0000 |
commit | f7ee62e6ccc3d3d94b57bcf1504514a4a79e53d9 (patch) | |
tree | 669a83dcc0273aa68fbed0dc55826c5984aae971 | |
parent | 56848683c4329b4d2b66234a1a82d03aad77c811 (diff) | |
download | FreeBSD-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.c | 9 | ||||
-rw-r--r-- | sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 9 |
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); |