svn commit: r285512 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Tue Jul 14 00:43:09 UTC 2015


Author: mjg
Date: Tue Jul 14 00:43:08 2015
New Revision: 285512
URL: https://svnweb.freebsd.org/changeset/base/285512

Log:
  exec plug a redundant vref + vrele of the image vnode

Modified:
  head/sys/kern/kern_exec.c

Modified: head/sys/kern/kern_exec.c
==============================================================================
--- head/sys/kern/kern_exec.c	Mon Jul 13 22:52:11 2015	(r285511)
+++ head/sys/kern/kern_exec.c	Tue Jul 14 00:43:08 2015	(r285512)
@@ -600,9 +600,6 @@ interpret:
 
 	vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
 
-	/* Get a reference to the vnode prior to locking the proc */
-	VREF(binvp);
-
 	/*
 	 * For security and other reasons, signal handlers cannot
 	 * be shared after an exec. The new process gets a copy of the old
@@ -767,8 +764,8 @@ interpret:
 	}
 
 	/*
-	 * Store the vp for use in procfs.  This vnode was referenced prior
-	 * to locking the proc lock.
+	 * Store the vp for use in procfs.  This vnode was referenced by namei
+	 * or fgetvp_exec.
 	 */
 	textvp = p->p_textvp;
 	p->p_textvp = binvp;
@@ -850,8 +847,6 @@ done1:
 	 */
 	if (textvp != NULL)
 		vrele(textvp);
-	if (error != 0)
-		vrele(binvp);
 #ifdef KTRACE
 	if (tracevp != NULL)
 		vrele(tracevp);
@@ -877,7 +872,10 @@ exec_fail_dealloc:
 			NDFREE(&nd, NDF_ONLY_PNBUF);
 		if (imgp->opened)
 			VOP_CLOSE(imgp->vp, FREAD, td->td_ucred, td);
-		vput(imgp->vp);
+		if (error != 0)
+			vput(imgp->vp);
+		else
+			VOP_UNLOCK(imgp->vp, 0);
 	}
 
 	if (imgp->object != NULL)


More information about the svn-src-all mailing list