]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix handling of errors from dmu_write_uio_dbuf() on FreeBSD
authorMark Johnston <markjdb@gmail.com>
Fri, 21 Jan 2022 19:54:05 +0000 (14:54 -0500)
committerMark Johnston <markj@FreeBSD.org>
Mon, 21 Feb 2022 14:59:58 +0000 (09:59 -0500)
commitb55a7f3422d76a6765716b2b6e78967bd75199c9
tree79548692706cfc4e947f89fc7d95ac72814a28e8
parent005452c350f5f2f3e16267557f3365a198336868
Fix handling of errors from dmu_write_uio_dbuf() on FreeBSD

FreeBSD's implementation of zfs_uio_fault_move() returns EFAULT when a
page fault occurs while copying data in or out of user buffers.  The VFS
treats such errors specially and will retry the I/O operation (which may
have made some partial progress).

When the FreeBSD and Linux implementations of zfs_write() were merged,
the handling of errors from dmu_write_uio_dbuf() changed such that
EFAULT is not handled as a partial write.  For example, when appending
to a file, the z_size field of the znode is not updated after a partial
write resulting in EFAULT.

Restore the old handling of errors from dmu_write_uio_dbuf() to fix
this.  This should have no impact on Linux, which has special handling
for EFAULT already.

Reviewed-by: Andriy Gapon <avg@FreeBSD.org>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Mark Johnston <markj@FreeBSD.org>
Closes #12964
(cherry picked from commit 063daa8350d4a78f96d1ee6550910363fd3756fb)
sys/contrib/openzfs/module/zfs/zfs_vnops.c