From vova@fbsd.ru  Mon Oct 30 17:27:18 2006
Return-Path: <vova@fbsd.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id B1D4416A47E
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 30 Oct 2006 17:27:18 +0000 (UTC)
	(envelope-from vova@fbsd.ru)
Received: from vbook.fbsd.ru (swsoft-mipt-nat.sw.ru [195.214.233.10])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7240743D9F
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 30 Oct 2006 17:27:01 +0000 (GMT)
	(envelope-from vova@fbsd.ru)
Received: from localhost.fbsd.ru ([127.0.0.1] helo=vbook.fbsd.ru)
	by vbook.fbsd.ru with esmtp (Exim 4.63 (FreeBSD))
	(envelope-from <vova@fbsd.ru>)
	id 1GeauQ-000GWR-Hx
	for FreeBSD-gnats-submit@freebsd.org; Mon, 30 Oct 2006 20:26:50 +0300
Message-Id: <1162229210.51920@vbook.fbsd.ru>
Date: Mon, 30 Oct 2006 20:26:50 +0300
From: "Vladimir Grebenschikov" <vova@fbsd.ru>
To: "FreeBSD gnats submit" <FreeBSD-gnats-submit@freebsd.org>
Subject: readlink("/proc/curproc/file") does not works above nullfs
X-Send-Pr-Version: gtk-send-pr 0.4.7 
X-GNATS-Notify:

>Number:         104938
>Category:       kern
>Synopsis:       [nullfs] [request] readlink("/proc/curproc/file") does not work over nullfs
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kib
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 30 17:30:24 GMT 2006
>Closed-Date:    Sun May 31 15:05:20 UTC 2009
>Last-Modified:  Sun May 31 15:05:20 UTC 2009
>Originator:     Vladimir Grebenschikov
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
SWsoft 
>Environment:


System: FreeBSD 7.0-CURRENT #0: Tue Sep 19 19:42:28 MSD 2006
    root@vbook.fbsd.ru:/usr/obj/usr/src/sys/VBOOK



>Description:


trying to find reason why jdk1.5 stop working, I have found that readlink
for /proc/curproc/file returns "unknown"

$ truss java
...
readlink("/proc/curproc/file","unknown",1024)    = 7 (0x7)
Error: could not find libjava.so
write(2,"Error: could not find libjava.so"...,33) = 33 (0x21)
Error: could not find Java 2 Runtime Environment.
write(2,"Error: could not find Java 2 Run"...,50) = 50 (0x32)
exit(0x2)
$

$ ps ax | fgrep java
49210  p0  S+     0:00.07 gdb /usr/local/jdk1.5.0/bin/java
49214  p0  TX     0:00.02 /usr/local/jdk1.5.0/bin/java
49224  p4  R+     0:00.00 fgrep java
$ ll /proc/49214/file 
lr--r--r--  1 vova  vova  0 Oct 30 20:16 /proc/49214/file -> unknown
$
>How-To-Repeat:
Just try to start jdk1.5 from nullfs-mounted partition
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->suspended 
State-Changed-By: rwatson 
State-Changed-When: Sat Mar 8 21:05:52 UTC 2008 
State-Changed-Why:  
This is a duplicate of kern/94269, and requires significant changes 
to nullfs in order to fix.  Leave as suspended as it's effectively 
a feature request; more detailed information may be found in the 
above-referenced PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=104938 
Responsible-Changed-From-To: freebsd-bugs->freebsd-fs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon May 18 04:25:07 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=104938 
State-Changed-From-To: suspended->open 
State-Changed-By: kib 
State-Changed-When: Mon May 18 14:17:22 UTC 2009 
State-Changed-Why:  
Take it. I have prototyped VOP_VPTOCNP bypass for nullfs on CURRENT. 


Responsible-Changed-From-To: freebsd-fs->kib 
Responsible-Changed-By: kib 
Responsible-Changed-When: Mon May 18 14:17:22 UTC 2009 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=104938 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/104938: commit references a PR
Date: Sun, 31 May 2009 14:58:58 +0000 (UTC)

 Author: kib
 Date: Sun May 31 14:58:43 2009
 New Revision: 193175
 URL: http://svn.freebsd.org/changeset/base/193175
 
 Log:
   Implement the bypass routine for VOP_VPTOCNP in nullfs.
   Among other things, this makes procfs <pid>/file working for executables
   started from nullfs mount.
   
   Tested by:	pho
   PR:	94269, 104938
 
 Modified:
   head/sys/fs/nullfs/null_vnops.c
 
 Modified: head/sys/fs/nullfs/null_vnops.c
 ==============================================================================
 --- head/sys/fs/nullfs/null_vnops.c	Sun May 31 14:57:43 2009	(r193174)
 +++ head/sys/fs/nullfs/null_vnops.c	Sun May 31 14:58:43 2009	(r193175)
 @@ -741,6 +741,55 @@ null_vptofh(struct vop_vptofh_args *ap)
  	return VOP_VPTOFH(lvp, ap->a_fhp);
  }
  
 +static int
 +null_vptocnp(struct vop_vptocnp_args *ap)
 +{
 +	struct vnode *vp = ap->a_vp;
 +	struct vnode **dvp = ap->a_vpp;
 +	struct vnode *lvp, *ldvp;
 +	int error, locked;
 +
 +	if (vp->v_type == VDIR)
 +		return (vop_stdvptocnp(ap));
 +
 +	locked = VOP_ISLOCKED(vp);
 +	lvp = NULLVPTOLOWERVP(vp);
 +	vhold(lvp);
 +	VOP_UNLOCK(vp, 0); /* vp is held by vn_vptocnp_locked that called us */
 +	ldvp = lvp;
 +	error = vn_vptocnp(&ldvp, ap->a_buf, ap->a_buflen);
 +	vdrop(lvp);
 +	if (error != 0) {
 +		vn_lock(vp, locked | LK_RETRY);
 +		return (ENOENT);
 +	}
 +
 +	/*
 +	 * Exclusive lock is required by insmntque1 call in
 +	 * null_nodeget()
 +	 */
 +	error = vn_lock(ldvp, LK_EXCLUSIVE);
 +	if (error != 0) {
 +		vn_lock(vp, locked | LK_RETRY);
 +		vdrop(ldvp);
 +		return (ENOENT);
 +	}
 +	vref(ldvp);
 +	vdrop(ldvp);
 +	error = null_nodeget(vp->v_mount, ldvp, dvp);
 +	if (error == 0) {
 +#ifdef DIAGNOSTIC
 +		NULLVPTOLOWERVP(*dvp);
 +#endif
 +		vhold(*dvp);
 +		vput(*dvp);
 +	} else
 +		vput(ldvp);
 +
 +	vn_lock(vp, locked | LK_RETRY);
 +	return (error);
 +}
 +
  /*
   * Global vfs data structures
   */
 @@ -762,6 +811,6 @@ struct vop_vector null_vnodeops = {
  	.vop_setattr =		null_setattr,
  	.vop_strategy =		VOP_EOPNOTSUPP,
  	.vop_unlock =		null_unlock,
 -	.vop_vptocnp =		vop_stdvptocnp,
 +	.vop_vptocnp =		null_vptocnp,
  	.vop_vptofh =		null_vptofh,
  };
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: kib 
State-Changed-When: Sun May 31 15:05:03 UTC 2009 
State-Changed-Why:  
Patch is in HEAD, no MFC planned. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=104938 
>Unformatted:
