From owner-svn-src-head@freebsd.org Tue Jul 14 00:43:09 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17CCF999CBF; Tue, 14 Jul 2015 00:43:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 08DD211AF; Tue, 14 Jul 2015 00:43:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6E0h8cU093147; Tue, 14 Jul 2015 00:43:08 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6E0h8En093146; Tue, 14 Jul 2015 00:43:08 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201507140043.t6E0h8En093146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 14 Jul 2015 00:43:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285512 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jul 2015 00:43:09 -0000 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)