From owner-freebsd-fs@FreeBSD.ORG Wed Jul 16 15:44:12 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 E7128106564A for ; Wed, 16 Jul 2008 15:44:12 +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 66A5D8FC1A for ; Wed, 16 Jul 2008 15:44:12 +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 m6GFi7O6080431 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 16 Jul 2008 18:44:07 +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 m6GFi7OV041762; Wed, 16 Jul 2008 18:44:07 +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 m6GFi72t041761; Wed, 16 Jul 2008 18:44:07 +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: Wed, 16 Jul 2008 18:44:07 +0300 From: Kostik Belousov To: Rick Macklem Message-ID: <20080716154407.GG17123@deviant.kiev.zoral.com.ua> References: <20080715203641.GA17123@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lPY6w/dILDkXzu1l" 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.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) 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: Wed, 16 Jul 2008 15:44:13 -0000 --lPY6w/dILDkXzu1l Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 16, 2008 at 11:32:28AM -0400, Rick Macklem wrote: > Patch looks good. It fixed my problem and hasn't crashed the system yet;-) Did you tested both elf executables and #!-scripts ? >=20 > Thanks, rick >=20 > On Tue, 15 Jul 2008, Kostik Belousov wrote: >=20 > >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. > >> > >>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, th= is > >>isn't a particularily good thing, since these Opens tie up resources on > >>the NFS server, etc. > >> > >>Anyone know if there is something I'm doing incorrectly that causes this > >>or a way to get the close to happen when the executable terminates? > >> > >>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); > > } > > > > --lPY6w/dILDkXzu1l Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkh+F0cACgkQC3+MBN1Mb4heSQCglg90q/P8YyBmAt2BSlC+rovK ek8AoNqF1sSuTmlU0sa6it8W6BC6ZoZ2 =7VvH -----END PGP SIGNATURE----- --lPY6w/dILDkXzu1l--