From 4fb48d10b0d5bde2cdfccb5dc36721166010c94f Mon Sep 17 00:00:00 2001 From: Paul Saab Date: Wed, 27 Jul 2005 15:05:31 +0000 Subject: [PATCH] In nfs_nget() if two threads race on the same filehandle, the loser should cause the nfsnode to get freed. This fixes a potential vnode (and nfsnode) leak in that path. Submitted by: Mohan Srinivasan Reviewed by: phk --- sys/nfsclient/nfs_node.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/nfsclient/nfs_node.c b/sys/nfsclient/nfs_node.c index f8621ae00454..47f5f4e7a60d 100644 --- a/sys/nfsclient/nfs_node.c +++ b/sys/nfsclient/nfs_node.c @@ -154,7 +154,8 @@ nfs_nget(struct mount *mntp, nfsfh_t *fhp, int fhsize, struct nfsnode **npp) return (error); if (nvp != NULL) { *npp = VTONFS(nvp); - /* XXX I wonder of nfs_reclaim will survive the unused vnode */ + /* vrele() the duplicate allocated here, to get it recycled */ + vrele(vp); return (0); } if (fhsize > NFS_SMALLFH) {