From ce19d1de2a12a31db8785309e108253c2a401076 Mon Sep 17 00:00:00 2001 From: Ben Kaduk Date: Wed, 29 May 2013 19:18:22 -0400 Subject: [PATCH] FBSD: plug refcount leak in pioctl When gop_lookupname_user returns a non-NULL vnode, the vnode came from afs_GetVCache (by way of afs_lookup) which takes a reference on the vnode entry. There's no need to take another spurious reference here. The existing code already knows that there's a reference in place, as there is an AFS_RELE down where FBSD80_ENV unlocks the vnode if it's locked (that code is also suspicious). Prior to this patch, things like 'fs flush /path/to/file' would leak a reference on that cache entry, preventing clean shutdown. Reviewed-on: http://gerrit.openafs.org/9957 Reviewed-by: Benjamin Kaduk Reviewed-by: Derrick Brashear Tested-by: BuildBot (cherry picked from commit 2bbba424ad6728a221688f782b4df90bf6da4a63) Change-Id: If9435903b32ca7001b418bc7a0fb611bda4d424e Reviewed-on: http://gerrit.openafs.org/10380 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk Reviewed-by: Stephan Wiesand --- src/afs/afs_pioctl.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 9787950cd..e0a744d28 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -1124,10 +1124,6 @@ afs_syscall_pioctl(char *path, unsigned int com, caddr_t cmarg, int follow) vp = (struct vnode *)dp->d_inode; #else code = gop_lookupname_user(path, AFS_UIOUSER, follow, &vp); -#if defined(AFS_FBSD80_ENV) /* XXX check on 7x */ - if (vp != NULL) - VN_HOLD(vp); -#endif /* AFS_FBSD80_ENV */ #endif /* AFS_LINUX22_ENV */ #endif /* AFS_AIX41_ENV */ AFS_GLOCK(); -- 2.39.5