From nobody Mon Oct 25 21:32:08 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5D203182D80F; Mon, 25 Oct 2021 21:32:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdSpJ6qQ7z3lQ8; Mon, 25 Oct 2021 21:32:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AAC9A105CD; Mon, 25 Oct 2021 21:32:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PLW8cs024303; Mon, 25 Oct 2021 21:32:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PLW83K024302; Mon, 25 Oct 2021 21:32:08 GMT (envelope-from git) Date: Mon, 25 Oct 2021 21:32:08 GMT Message-Id: <202110252132.19PLW83K024302@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 37a1501ed3dc - stable/13 - nfscl: Fix NFS VOP_ALLOCATE for mounts without Allocate support List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 37a1501ed3dc05b875e6cb5ba0cf9a163ed4f622 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=37a1501ed3dc05b875e6cb5ba0cf9a163ed4f622 commit 37a1501ed3dc05b875e6cb5ba0cf9a163ed4f622 Author: Rick Macklem AuthorDate: 2021-10-10 21:27:52 +0000 Commit: Rick Macklem 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)