From owner-freebsd-fs@FreeBSD.ORG Wed Jul 16 15:22:04 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 0C7FE1065679 for ; Wed, 16 Jul 2008 15:22:04 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from mailhub.cs.uoguelph.ca (mailhub.cs.uoguelph.ca [131.104.94.205]) by mx1.freebsd.org (Postfix) with ESMTP id BEA158FC26 for ; Wed, 16 Jul 2008 15:22:03 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from muncher.cs.uoguelph.ca (muncher.cs.uoguelph.ca [131.104.91.102]) by mailhub.cs.uoguelph.ca (8.13.1/8.13.1) with ESMTP id m6GFM2Sq016271; Wed, 16 Jul 2008 11:22:02 -0400 Received: from localhost (rmacklem@localhost) by muncher.cs.uoguelph.ca (8.11.7p3+Sun/8.11.6) with ESMTP id m6GFWTQ05160; Wed, 16 Jul 2008 11:32:29 -0400 (EDT) X-Authentication-Warning: muncher.cs.uoguelph.ca: rmacklem owned process doing -bs Date: Wed, 16 Jul 2008 11:32:28 -0400 (EDT) From: Rick Macklem X-X-Sender: rmacklem@muncher.cs.uoguelph.ca To: Kostik Belousov In-Reply-To: <20080715203641.GA17123@deviant.kiev.zoral.com.ua> Message-ID: References: <20080715203641.GA17123@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Scanned-By: MIMEDefang 2.63 on 131.104.94.205 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:22:04 -0000 Patch looks good. It fixed my problem and hasn't crashed the system yet;-) Thanks, rick On Tue, 15 Jul 2008, Kostik Belousov wrote: > 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, this >> 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 = 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 = NULL; > @@ -845,6 +846,7 @@ exec_fail_dealloc: > if (imgp->vp != NULL) { > if (args->fname) > NDFREE(ndp, NDF_ONLY_PNBUF); > + VOP_CLOSE(imgp->vp, FREAD, td->td_ucred, td); > vput(imgp->vp); > } > >