From owner-freebsd-fs@FreeBSD.ORG Tue Jul 15 20:36:46 2008 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2ED6B1065673 for ; Tue, 15 Jul 2008 20:36:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id 95F858FC08 for ; Tue, 15 Jul 2008 20:36:45 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m6FKafdX009784 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 15 Jul 2008 23:36:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m6FKafOD019692; Tue, 15 Jul 2008 23:36:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m6FKafHx019691; Tue, 15 Jul 2008 23:36:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 15 Jul 2008 23:36:41 +0300 From: Kostik Belousov To: Rick Macklem Message-ID: <20080715203641.GA17123@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3Klj4d7nt2xGOswL" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.91.2, clamav-milter version 0.91.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.4 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on skuns.kiev.zoral.com.ua Cc: freebsd-fs@freebsd.org Subject: Re: executable open until unmount X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jul 2008 20:36:46 -0000 --3Klj4d7nt2xGOswL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 15, 2008 at 02:57:23PM -0400, Rick Macklem wrote: > I'm testing my nfsv4 client and I've run into this issue under FreeBSD7.0. >=20 > When I execute a file on the nfs mounted volume, the file remains open > until the vnode gets cleared out, usually when I unmount. For NFSv4, this > isn't a particularily good thing, since these Opens tie up resources on > the NFS server, etc. >=20 > Anyone know if there is something I'm doing incorrectly that causes this= =20 > or a way to get the close to happen when the executable terminates? >=20 > Thanks in advance for any help, rick Try this: diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index f4335a2..c3ef0e9 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -496,6 +496,7 @@ interpret: interplabel =3D mac_vnode_label_alloc(); mac_vnode_copy_label(binvp->v_label, interplabel); #endif + VOP_CLOSE(binvp, FREAD, td->td_ucred, td); vput(binvp); vm_object_deallocate(imgp->object); imgp->object =3D NULL; @@ -845,6 +846,7 @@ exec_fail_dealloc: if (imgp->vp !=3D NULL) { if (args->fname) NDFREE(ndp, NDF_ONLY_PNBUF); + VOP_CLOSE(imgp->vp, FREAD, td->td_ucred, td); vput(imgp->vp); } =20 --3Klj4d7nt2xGOswL Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkh9ClgACgkQC3+MBN1Mb4iGkACdFDUQblFAhYx/p4/5TWfPyDR+ LOUAn1LY0GLq7xLQToEV1ttkc3LOP2mL =LWL/ -----END PGP SIGNATURE----- --3Klj4d7nt2xGOswL--