Return EFAULT at the end of zfs_write() when set
FreeBSD's VFS expects EFAULT from zfs_write() if we didn't complete the full write so it can retry the operation. Add some missing SET_ERRORs in zfs_write(). Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11193
This commit is contained in:
parent
b2255edcc0
commit
7e3617de35
|
@ -412,7 +412,7 @@ zfs_write(znode_t *zp, uio_t *uio, int ioflag, cred_t *cr)
|
||||||
if (zn_rlimit_fsize(zp, uio, uio->uio_td)) {
|
if (zn_rlimit_fsize(zp, uio, uio->uio_td)) {
|
||||||
zfs_rangelock_exit(lr);
|
zfs_rangelock_exit(lr);
|
||||||
ZFS_EXIT(zfsvfs);
|
ZFS_EXIT(zfsvfs);
|
||||||
return (EFBIG);
|
return (SET_ERROR(EFBIG));
|
||||||
}
|
}
|
||||||
|
|
||||||
const rlim64_t limit = MAXOFFSET_T;
|
const rlim64_t limit = MAXOFFSET_T;
|
||||||
|
@ -652,7 +652,7 @@ zfs_write(znode_t *zp, uio_t *uio, int ioflag, cred_t *cr)
|
||||||
|
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
if (uio_prefaultpages(MIN(n, max_blksz), uio)) {
|
if (uio_prefaultpages(MIN(n, max_blksz), uio)) {
|
||||||
error = EFAULT;
|
error = SET_ERROR(EFAULT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -662,10 +662,12 @@ zfs_write(znode_t *zp, uio_t *uio, int ioflag, cred_t *cr)
|
||||||
zfs_rangelock_exit(lr);
|
zfs_rangelock_exit(lr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we're in replay mode, or we made no progress, return error.
|
* If we're in replay mode, or we made no progress, or the
|
||||||
* Otherwise, it's at least a partial write, so it's successful.
|
* uio data is inaccessible return an error. Otherwise, it's
|
||||||
|
* at least a partial write, so it's successful.
|
||||||
*/
|
*/
|
||||||
if (zfsvfs->z_replay || uio->uio_resid == start_resid) {
|
if (zfsvfs->z_replay || uio->uio_resid == start_resid ||
|
||||||
|
error == EFAULT) {
|
||||||
ZFS_EXIT(zfsvfs);
|
ZFS_EXIT(zfsvfs);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue