executable open until unmount

Kostik Belousov kostikbel at gmail.com
Tue Jul 15 20:36:46 UTC 2008


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);
 	}
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20080715/43ae86c6/attachment.pgp


More information about the freebsd-fs mailing list