git: 0ed8ae14d9e0 - stable/14 - nfscl: Add a check for VREG for delegations
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 13 Jul 2024 00:49:58 UTC
The branch stable/14 has been updated by rmacklem:
URL: https://cgit.FreeBSD.org/src/commit/?id=0ed8ae14d9e09f494bdae74398deae55ba9526f7
commit 0ed8ae14d9e09f494bdae74398deae55ba9526f7
Author: Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2024-06-12 23:17:23 +0000
Commit: Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2024-07-13 00:49:05 +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.
(cherry picked from commit 4308d6e0fc09c807483f09b8fea7f5182d19fd01)
---
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 f66065f1f0bd..0a1eb51e279f 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 *,
@@ -4653,7 +4652,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) {
@@ -4693,7 +4692,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) {