git: cf2ff49e6e5e - main - nfs_nfsdserv.c: Fix nfsrvd_openattr() for vnode locking
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 18 Jul 2025 18:50:53 UTC
The branch main has been updated by rmacklem:
URL: https://cgit.FreeBSD.org/src/commit/?id=cf2ff49e6e5e3b9ac28e4f853a6ec9d9599d69b1
commit cf2ff49e6e5e3b9ac28e4f853a6ec9d9599d69b1
Author: Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2025-07-18 18:47:59 +0000
Commit: Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2025-07-18 18:47:59 +0000
nfs_nfsdserv.c: Fix nfsrvd_openattr() for vnode locking
Without this patch, nfsrvd_openattr() requests an unlocked
vnode via VOP_LOOKUP(). This is not allowed for
"options DEBUG_VFS_LOCKS" kernels, so this patch requests a
locked vnode and then unlocks it.
Fixes: e4c7b2b6053f ("nfsv4: Add support to NFSv4 for named attributes")
---
sys/fs/nfsserver/nfs_nfsdserv.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c
index f7564ade401b..3acf07d5253b 100644
--- a/sys/fs/nfsserver/nfs_nfsdserv.c
+++ b/sys/fs/nfsserver/nfs_nfsdserv.c
@@ -4353,9 +4353,10 @@ nfsrvd_openattr(struct nfsrv_descript *nd, __unused int isdgram,
int error = 0;
NFSNAMEICNDSET(&cn, nd->nd_cred, LOOKUP, OPENNAMED | ISLASTCN |
- NOFOLLOW);
+ NOFOLLOW | LOCKLEAF);
cn.cn_nameptr = ".";
cn.cn_namelen = 1;
+ cn.cn_lkflags = LK_SHARED;
NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED);
if (*tl == newnfs_true)
cn.cn_flags |= CREATENAMED;
@@ -4374,6 +4375,8 @@ nfsrvd_openattr(struct nfsrv_descript *nd, __unused int isdgram,
if (nd->nd_repstat == ENOATTR)
nd->nd_repstat = NFSERR_NOENT;
}
+ if (nd->nd_repstat == 0)
+ NFSVOPUNLOCK(*vpp);
vput(dp);
NFSEXITCODE2(0, nd);