git: 37a1501ed3dc - stable/13 - nfscl: Fix NFS VOP_ALLOCATE for mounts without Allocate support
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 25 Oct 2021 21:32:08 UTC
The branch stable/13 has been updated by rmacklem:
URL: https://cgit.FreeBSD.org/src/commit/?id=37a1501ed3dc05b875e6cb5ba0cf9a163ed4f622
commit 37a1501ed3dc05b875e6cb5ba0cf9a163ed4f622
Author: Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2021-10-10 21:27:52 +0000
Commit: Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2021-10-25 21:28:47 +0000
nfscl: Fix NFS VOP_ALLOCATE for mounts without Allocate support
Without this patch, nfs_allocate() fell back on using vop_stdallocate()
for NFS mounts without Allocate operation support. This was incorrect,
since some file systems, such as ZFS, cannot do allocate via
vop_stdallocate(), which uses writes to try and allocate blocks.
Also, fix nfs_allocate() to return EINVAL when mounts cannot do Allocate,
since that is the correct error for posix_fallocate(2).
Note that Allocate is only supported by some NFSv4.2 servers.
(cherry picked from commit 235891a1273d99b86784f935d2d6c554ce189559)
---
sys/fs/nfsclient/nfs_clvnops.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c
index 29b0cdce4bbc..8da0186c3c62 100644
--- a/sys/fs/nfsclient/nfs_clvnops.c
+++ b/sys/fs/nfsclient/nfs_clvnops.c
@@ -3649,17 +3649,12 @@ nfs_allocate(struct vop_allocate_args *ap)
mtx_lock(&nmp->nm_mtx);
nmp->nm_privflag |= NFSMNTP_NOALLOCATE;
mtx_unlock(&nmp->nm_mtx);
+ error = EINVAL;
}
} else {
mtx_unlock(&nmp->nm_mtx);
- error = EIO;
+ error = EINVAL;
}
- /*
- * If the NFS server cannot perform the Allocate operation, just call
- * vop_stdallocate() to perform it.
- */
- if (error != 0)
- error = vop_stdallocate(ap);
if (attrflag != 0) {
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
if (error == 0 && ret != 0)