Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jun 2024 23:18:24 GMT
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4308d6e0fc09 - main - nfscl: Add a check for VREG for delegations
Message-ID:  <202406122318.45CNIOVa012075@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=4308d6e0fc09c807483f09b8fea7f5182d19fd01

commit 4308d6e0fc09c807483f09b8fea7f5182d19fd01
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2024-06-12 23:17:23 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2024-06-12 23:17:23 +0000

    nfscl: Add a check for VREG for delegations
    
    Since delegations are only issued for regular files, check
    v_type to see if the query is for a regular file.  This is
    a simple optimization for the non-VREG case.
    While here, fix a couple of global variable declarations.
    
    This patch should only affect the NFSv4.1/4.2 behaviour
    when delegations are enabled, which is not the default.
    
    MFC after:      1 month
---
 sys/fs/nfsclient/nfs_clstate.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index 9fbaa6e63a56..aef5d71592af 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -93,9 +93,8 @@ NFSREQSPINLOCK;
 NFSCLSTATEMUTEX;
 int nfscl_inited = 0;
 struct nfsclhead nfsclhead;	/* Head of clientid list */
-int nfscl_deleghighwater = NFSCLDELEGHIGHWATER;
-int nfscl_layouthighwater = NFSCLLAYOUTHIGHWATER;
 
+static int nfscl_deleghighwater = NFSCLDELEGHIGHWATER;
 static int nfscl_delegcnt = 0;
 static int nfscl_layoutcnt = 0;
 static int nfscl_getopen(struct nfsclownerhead *, struct nfsclopenhash *,
@@ -4647,7 +4646,7 @@ nfscl_mustflush(vnode_t vp)
 
 	np = VTONFS(vp);
 	nmp = VFSTONFS(vp->v_mount);
-	if (!NFSHASNFSV4(nmp))
+	if (!NFSHASNFSV4(nmp) || vp->v_type != VREG)
 		return (1);
 	NFSLOCKMNT(nmp);
 	if ((nmp->nm_privflag & NFSMNTP_DELEGISSUED) == 0) {
@@ -4687,7 +4686,7 @@ nfscl_nodeleg(vnode_t vp, int writedeleg)
 
 	np = VTONFS(vp);
 	nmp = VFSTONFS(vp->v_mount);
-	if (!NFSHASNFSV4(nmp))
+	if (!NFSHASNFSV4(nmp) || vp->v_type != VREG)
 		return (1);
 	NFSLOCKMNT(nmp);
 	if ((nmp->nm_privflag & NFSMNTP_DELEGISSUED) == 0) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202406122318.45CNIOVa012075>