From nobody@FreeBSD.org  Mon Nov  5 00:46:47 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2187616A418
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  5 Nov 2007 00:46:47 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 1539413C49D
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  5 Nov 2007 00:46:47 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.1/8.14.1) with ESMTP id lA50kagm098403
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 5 Nov 2007 00:46:36 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.1/8.14.1/Submit) id lA50kZ1C098402;
	Mon, 5 Nov 2007 00:46:35 GMT
	(envelope-from nobody)
Message-Id: <200711050046.lA50kZ1C098402@www.freebsd.org>
Date: Mon, 5 Nov 2007 00:46:35 GMT
From: Sebastian Klemke <packet@adrenochrome.nl>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [unionfs] can't mount devfs on top of unionfs anymore
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         117829
>Category:       kern
>Synopsis:       [unionfs] [patch] can't mount devfs on top of unionfs anymore [regression]
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    daichi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 05 00:50:02 UTC 2007
>Closed-Date:    Wed May 07 08:08:37 UTC 2008
>Last-Modified:  Wed May  7 08:10:01 UTC 2008
>Originator:     Sebastian Klemke
>Release:        6-STABLE
>Organization:
>Environment:
FreeBSD roterstern.xberg.nerdheim.de 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #0: Sun Nov  4 03:22:17 CET 2007     root@roterstern.xberg.nerdheim.de:/usr/obj/usr/src/sys/ROTERSTERN  i386
>Description:
My jail setup is broken due to unionfs trouble: I'm using unionfs to overlay jail-specific stuff over a world. The trouble is that devfs on top of unionfs does not seem to work anymore in 6-STABLE (I suspect the Oct 23, 2007 changes in sys/fs/unionfs, but haven't had the time to test with an older checkout). This is what I got in my rc.conf:

jail_enable="YES"
jail_devfs_enable="YES"
jail_mount_enable="YES"
jail_interface="fxp0"
jail_devfs_ruleset="devfsrules_jail"
jail_set_hostname_allow="NO"
jail_socket_unixiproute_only="YES"
jail_sysvipc_allow="YES"
jail_list="svn"
jail_svn_rootdir="/home/jails/svn"
jail_svn_hostname="svn.xberg.nerdheim.de"
jail_svn_ip="192.168.0.75"

When starting the jail via /etc/rc.d/jail start, the unionfs gets mounted and then on top of the unionfs, devfs is mounted. I can confirm with mount and sh -x that devfs is really mounted on top of unionfs, no errors. But then, when rulesets are applied to the new devfs I get:

+ debug devfs_set_ruleset: setting ruleset (4) on mount-point (/home/jails/svn/dev)
+ /sbin/devfs -m /home/jails/svn/dev ruleset 4
devfs ruleset: ioctl DEVFSIO_SUSE: Inappropriate ioctl for device
+ warn devfs_set_ruleset: unable to set ruleset 4 to /home/jails/svn/dev
+ [ -x /usr/bin/logger ]
+ logger /etc/rc.d/jail: WARNING: devfs_set_ruleset: unable to set ruleset 4 to /home/jails/svn/dev
+ echo /etc/rc.d/jail: WARNING: devfs_set_ruleset: unable to set ruleset 4 to /home/jails/svn/dev
/etc/rc.d/jail: WARNING: devfs_set_ruleset: unable to set ruleset 4 to /home/jails/svn/dev
+ return 1
+ devfs -m /home/jails/svn/dev rule applyset
devfs rule: ioctl DEVFSIO_SAPPLY: Inappropriate ioctl for device

When I examine the mountpoints of the devfs with ls, it looks like a normal directory without devfs mounted. I'm using -o below for the unionfs and everything written into /home/jails/svn/dev ends up getting written to the real, physical /home/jails/svn/dev that resides on my /home filesystem, like it would be expected if devfs wasn't mounted. But actually devfs is mounted, I can even umount it.
>How-To-Repeat:
1. mkdir /tmp/a /tmp/b /tmp/b/dev
2. mount -t unionfs -o below /tmp/a /tmp/b
3. mount -t devfs dev /tmp/b/dev
4. now examine b/dev: It's possible to umount /tmp/b/dev, but nothing is really there
>Fix:


>Release-Note:
>Audit-Trail:

From: Sebastian Klemke <packet@nerdheim.de>
To: bug-followup@freebsd.org, packet@adrenochrome.nl
Cc:  
Subject: Re: kern/117829: [unionfs] can't mount devfs on top of unionfs anymore
Date: Tue, 6 Nov 2007 17:04:54 +0100

 --nextPart3999980.s5njtmLRQi
 Content-Type: text/plain;
   charset="us-ascii"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: inline
 
 I now did a cvs up -rRELENG_6 -D20071022 and built a kernel with the=20
 sources from Oct 22, 2007. It works. So the Oct 23, 2007 changes have=20
 broken unionfs in 6-STABLE.
 
 --nextPart3999980.s5njtmLRQi
 Content-Type: application/pgp-signature; name=signature.asc 
 Content-Description: This is a digitally signed message part.
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (GNU/Linux)
 
 iD8DBQBHMJC+RHQcqNQQb+kRAq6JAJ92Tep6pFCzdfASpYQX7AoeF9XUbQCffQRY
 HkfqfsdKPe4M7lC2uRbTFq4=
 =9nXl
 -----END PGP SIGNATURE-----
 
 --nextPart3999980.s5njtmLRQi--
Responsible-Changed-From-To: freebsd-bugs->daichi 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Feb 14 18:45:20 UTC 2008 
Responsible-Changed-Why:  
Goto-san, this problem seems to have occured with the MFC that you did; 
is it possible for you to take a look?  Thank you. 

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

From: "Alexander V. Chernikov" <admin@su29.net>
To: bug-followup@FreeBSD.org, packet@adrenochrome.nl
Cc:  
Subject: Re: kern/117829: [unionfs] can't mount devfs on top of unionfs anymore
 (regression)
Date: Mon, 18 Feb 2008 14:58:28 +0300

 This patch solves the problem
 
 ---------------------------------------------------------------------------
 --- sys/kern/vfs_cache.c.old    2008-02-18 13:42:14.000000000 +0300
 +++ sys/kern/vfs_cache.c        2008-02-18 13:42:19.000000000 +0300
 @@ -615,6 +615,24 @@
  }
 
  /*
 + * Invalidate all entries to a particular vnode
 + * skipping 'upper' nodes and node itself
 + */
 +void
 +cache_purge_skipdst(vp)
 +       struct vnode *vp;
 +{
 +       struct namecache *ncp;
 +
 +       CTR1(KTR_VFS, "%s(%p)", __FUNCTION__, vp);
 +       CACHE_LOCK();
 +       while (!LIST_EMPTY(&vp->v_cache_src))
 +               cache_zap(LIST_FIRST(&vp->v_cache_src));
 +       vp->v_dd = NULL;
 +       CACHE_UNLOCK();
 +}
 +
 +/*
   * Flush all entries referencing a particular filesystem.
   */
  void
 --- /usr/src/sys/sys/vnode.h.old        2008-02-18 13:42:50.000000000 +0300
 +++ /usr/src/sys/sys/vnode.h    2008-02-18 13:42:52.000000000 +0300
 @@ -564,6 +564,7 @@
  int    cache_lookup(struct vnode *dvp, struct vnode **vpp,
             struct componentname *cnp);
  void   cache_purge(struct vnode *vp);
 +void   cache_purge_skipdst(struct vnode *vp);
  void   cache_purgevfs(struct mount *mp);
  int    change_dir(struct vnode *vp, struct thread *td);
  int    change_root(struct vnode *vp, struct thread *td);
 --- /usr/src/sys/kern/vfs_mount.c.old   2008-02-18 13:43:57.000000000 +0300
 +++ /usr/src/sys/kern/vfs_mount.c       2008-02-18 13:44:05.000000000 +0300
 @@ -1066,7 +1066,7 @@
         /*
          * Put the new filesystem on the mount list after root.
          */
 -       cache_purge(vp);
 +       cache_purge_skipdst(vp);
         if (!error) {
                 struct vnode *newdp;
 ---------------------------------------------------------------------------
 
 Problem relies in unionfs relying on vfs cache. If vnode is not found in 
 cache,
 vnode is recreated via unionfs_vnodeget(). This works in almost all cases.
 FreeBSD's lookup() call (called by namei()) works as follows:
 splits path into subdirectory pieces and lookups 'next' subdirectory 
 vnode via
 .vop_lookup filesystem method (vfs_cache_lookup() mostly). This 
 procedure tries
 to find needed entry in cache and in case of failure calls 
 .vop_cached_lookup filesystem method
 (unionfs_lookup() in our case).
 Then lookup() code checks if returned vnode is another filesystem root 
 (has v_mountedhere field set).
 If  this field is set, next lookup is done with 'new' filesystem methods 
 (procfs or devfs in our case).
 
 When mount(2) call is done (we're mounting procfs on some unionfs path) 
 vfs_domount() is called.
 It retrieves needed new filesystem 'root' vnode via namei(). As vfs 
 subsystem asks this call to be cached (MAKEENTRY flag is set in lookup 
 flags)
 unionfs_lookup() puts this entry to vfs cache (via cache_enter()).
 Next, mount is nearly done (filesystem procedure for mount returns) 
 vfs_domount calls cache_purge() on
 our 'root' vnode. For some reasons (vn_fullpath1?) cache_enter() puts 
 vnode on vnode's v_cache_dst list which is
 cleared via cache_purge(). After that v_mountedhere on our vnode. As a 
 result, we've got successul mount and vnode not in cache.
 'Normal' filesystems find this vnode on next lookup via inode->i_vnode. 
 Unionfs cannot do this without own cache, so it simply allocates
 new vnode and you see empty directory instead of mounted partition.
 
 However if you do chdir to procfs/devfs mount point befor mount in any 
 process and do 'ls' after mount you will see 'real' procfs/devfs.
 This is effect of mountcheckdirs().
 
 Proposed fix skips removing 'upper' nodes and self from cache list (only 
 'lower' vnodes became invalid in case of successful mount)
 
 
 mount debug output with comments follows:
 
 /*
  * procfs mount example
  * Most debug output is done via vn_printf()
  * Debug starts from namei() call in vfs_domount()
  /
 
 /* dvp and path is shown here */
 Feb 17 11:34:08 ws kernel: [cACHE_LOOKUP]:cache_lookup:332 path: proc
 Feb 17 11:34:08 ws kernel: 0xffffff001f434000: tag unionfs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 2, writecount 0, refcount 2 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags (VV_ROOT)
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: unionfs_vp=0xffffff001f434000, 
 uppervp=0xffffff001f4343e0, lowervp=0xffffff00044735d0
 Feb 17 11:34:08 ws kernel: unionfs: upper
 Feb 17 11:34:08 ws kernel: 0xffffff001f4343e0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 2, writecount 0, refcount 4 
 mountedhere 0xffffff00040bf978
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: ino 32950, on dev ad10s1a
 Feb 17 11:34:08 ws kernel: unionfs: lower
 Feb 17 11:34:08 ws kernel: 0xffffff00044735d0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 30, writecount 0, refcount 32 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: v_object 0xffffff0004f6abd0 ref 0 pages 0
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: ino 23553, on dev ad10s1f
 
 /*
  * Counting hash from dvp(parernt node) + path
  * hash2/p is path hash, hash/r is resulting hash
  */
 Feb 17 11:34:08 ws kernel: [HASH] hash/r: 1068258652 hash2/p: 754463455 
 path: proc dvp: 0xffffff001f434000
 
 /* Not found in cached, calling unionfs_lookup() -> unionfs_nodeget() */
 Feb 17 11:34:08 ws kernel: unionfs_nodeget()
 /* Our 'central' vnode - 0xffffff001f6605d0 */
 Feb 17 11:34:08 ws kernel: 0xffffff001f6605d0: tag unionfs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 1, writecount 0, refcount 1 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: unionfs_vp=0xffffff001f6605d0, 
 uppervp=0xffffff001f433ba0, lowervp=0xffffff00042131f0
 Feb 17 11:34:08 ws kernel: unionfs: upper
 Feb 17 11:34:08 ws kernel: 0xffffff001f433ba0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 2, writecount 0, refcount 2 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: ino 32951, on dev ad10s1a
 Feb 17 11:34:08 ws kernel: unionfs: lower
 Feb 17 11:34:08 ws kernel: 0xffffff00042131f0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 3, writecount 0, refcount 5 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: v_object 0xffffff000443d798 ref 0 pages 1
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: ino 659464, on dev ad10s1f
 
 
 /*
  * Putting this vnode to cach (MAKEENTRY in cn_flags is set)
  * (near end of unionfs_lookup())
  */
 Feb 17 11:34:08 ws kernel: [CACHE_ENTER]:unionfs_lookup:355() path: proc
 Feb 17 11:34:08 ws kernel: 0xffffff001f6605d0: tag unionfs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 1, writecount 0, refcount 1 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: unionfs_vp=0xffffff001f6605d0, 
 uppervp=0xffffff001f433ba0, lowervp=0xffffff00042131f0
 Feb 17 11:34:08 ws kernel: unionfs: upper
 Feb 17 11:34:08 ws kernel: 0xffffff001f433ba0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 2, writecount 0, refcount 2 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: ino 32951, on dev ad10s1a
 Feb 17 11:34:08 ws kernel: unionfs: lower
 Feb 17 11:34:08 ws kernel: 0xffffff00042131f0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 3, writecount 0, refcount 5 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: v_object 0xffffff000443d798 ref 0 pages 1
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: ino 659464, on dev ad10s1f
 
 /* Counting hash.. */
 Feb 17 11:34:08 ws kernel: [HASH] cache_enter:539 hash/r: 1068258652 
 hash2/p: 754463455 path: proc vn/dvp: 0xffffff001f6605d0/0xffffff001f434000
 
 /*
  * unionfs_cache_lookup() - just debugging function calling 
 vfs_cache_lookup() immediately
  * This debug is called after vfs_cache_lookup() finished [successfully]
  * Returned vnode is 'our' vnode
  */
 Feb 17 11:34:08 ws kernel: [CACHE_LOOKUP]:unionfs_cache_lookup:103() 
 path: proc
 Feb 17 11:34:08 ws kernel: 0xffffff001f6605d0: tag unionfs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 1, writecount 0, refcount 1 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: unionfs_vp=0xffffff001f6605d0, 
 uppervp=0xffffff001f433ba0, lowervp=0xffffff00042131f0
 Feb 17 11:34:08 ws kernel: unionfs: upper
 Feb 17 11:34:08 ws kernel: 0xffffff001f433ba0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 1, writecount 0, refcount 1 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: ino 32951, on dev ad10s1a
 Feb 17 11:34:08 ws kernel: unionfs: lower
 Feb 17 11:34:08 ws kernel: 0xffffff00042131f0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 2, writecount 0, refcount 4 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: v_object 0xffffff000443d798 ref 0 pages 1
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: ino 659464, on dev ad10s1f
 Feb 17 11:34:08 ws kernel: >------------<
 
 /*
  * This debug is called immediately after namei() in vfs_domount()
  * The same, we see 'our' vnode
  */
 Feb 17 11:34:08 ws kernel: vfs_domount:896()
 Feb 17 11:34:08 ws kernel: 0xffffff001f6605d0: tag unionfs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 1, writecount 0, refcount 1 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: unionfs_vp=0xffffff001f6605d0, 
 uppervp=0xffffff001f433ba0, lowervp=0xffffff00042131f0
 Feb 17 11:34:08 ws kernel: unionfs: upper
 Feb 17 11:34:08 ws kernel: 0xffffff001f433ba0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 1, writecount 0, refcount 1 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: ino 32951, on dev ad10s1a
 Feb 17 11:34:08 ws kernel: unionfs: lower
 Feb 17 11:34:08 ws kernel: 0xffffff00042131f0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 2, writecount 0, refcount 4 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: v_object 0xffffff000443d798 ref 0 pages 1
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: ino 659464, on dev ad10s1f
 Feb 17 11:34:08 ws kernel: >----------------<
 
 /*
  * vfs_purge() was called with 'our' vnode as argument.
  * This is nearly the end of vfs_domount()
  */
 Feb 17 11:34:08 ws kernel: cache_purge:600()
 Feb 17 11:34:08 ws kernel: v_cache_src: 0 v_cache_dst: >0
 Feb 17 11:34:08 ws kernel: 0xffffff001f6605d0: tag unionfs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 1, writecount 0, refcount 1 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags (VI_MOUNT)
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: unionfs_vp=0xffffff001f6605d0, 
 uppervp=0xffffff001f433ba0, lowervp=0xffffff00042131f0
 Feb 17 11:34:08 ws kernel: unionfs: upper
 Feb 17 11:34:08 ws kernel: 0xffffff001f433ba0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 1, writecount 0, refcount 1 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: ino 32951, on dev ad10s1a
 Feb 17 11:34:08 ws kernel: unionfs: lower
 Feb 17 11:34:08 ws kernel: 0xffffff00042131f0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 2, writecount 0, refcount 4 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: v_object 0xffffff000443d798 ref 0 pages 1
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: ino 659464, on dev ad10s1f
 
 /*
  * Debug code here:
  * while (!TAILQ_EMPTY(&vp->v_cache_dst)) {
  * ncp = TAILQ_FIRST(&vp->v_cache_dst);
  * printf("[ZAP/d] %p\n", ncp ? ncp->nc_vp : NULL);
  * cache_zap(TAILQ_FIRST(&vp->v_cache_dst));
  *
  * 'Our' vnode is being removed from cache
 */
 Feb 17 11:34:08 ws kernel: [ZAP/d] 0xffffff001f6605d0
 Feb 17 11:34:08 ws kernel: [HASH] cache_zap:277 
 0xffffff001f6605d0/0xffffff001f434000 'proc' deleted
 Feb 17 11:34:08 ws kernel: >------------<
 
 /*
  * Debug inside
  * if (!error) {
  *
  * immediately after cache_purge()
  *
  * See v_mountedhere field set
  */
 Feb 17 11:34:08 ws kernel: vfs_domount:1077()
 Feb 17 11:34:08 ws kernel: 0xffffff001f6605d0: tag unionfs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 1, writecount 0, refcount 1 
 mountedhere 0xffffff00040bf650
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: unionfs_vp=0xffffff001f6605d0, 
 uppervp=0xffffff001f433ba0, lowervp=0xffffff00042131f0
 Feb 17 11:34:08 ws kernel: unionfs: upper
 Feb 17 11:34:08 ws kernel: 0xffffff001f433ba0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 1, writecount 0, refcount 1 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: ino 32951, on dev ad10s1a
 Feb 17 11:34:08 ws kernel: unionfs: lower
 Feb 17 11:34:08 ws kernel: 0xffffff00042131f0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 2, writecount 0, refcount 4 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: v_object 0xffffff000443d798 ref 0 pages 1
 Feb 17 11:34:08 ws kernel: lock type ufs: EXCL (count 1) by thread 
 0xffffff000436aa20 (pid 1140)
 Feb 17 11:34:08 ws kernel: ino 659464, on dev ad10s1f
 Feb 17 11:34:08 ws kernel: >------------<
 
 /*
  * Just vnode dump immediately before the return()
  *
  * See refcount = 1
  */
 Feb 17 11:34:08 ws kernel: [RET]vfs_domount:1100()
 Feb 17 11:34:08 ws kernel: 0xffffff001f6605d0: tag unionfs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 1, writecount 0, refcount 1 
 mountedhere 0xffffff00040bf650
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel:
 Feb 17 11:34:08 ws kernel: unionfs_vp=0xffffff001f6605d0, 
 uppervp=0xffffff001f433ba0, lowervp=0xffffff00042131f0
 Feb 17 11:34:08 ws kernel: unionfs: upper
 Feb 17 11:34:08 ws kernel: 0xffffff001f433ba0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 1, writecount 0, refcount 1 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel:
 Feb 17 11:34:08 ws kernel: ino 32951, on dev ad10s1a
 Feb 17 11:34:08 ws kernel: unionfs: lower
 Feb 17 11:34:08 ws kernel: 0xffffff00042131f0: tag ufs, type VDIR
 Feb 17 11:34:08 ws kernel: usecount 2, writecount 0, refcount 4 
 mountedhere 0
 Feb 17 11:34:08 ws kernel: flags ()
 Feb 17 11:34:08 ws kernel: v_object 0xffffff000443d798 ref 0 pages 1
 Feb 17 11:34:08 ws kernel:
 Feb 17 11:34:08 ws kernel: ino 659464, on dev ad10s1f
 
 
 
 
 /*
  * So, on the next lookup vfs_cache_lookup() will not find this vnode in 
 cache and
  * unionfs_lookup() -> unionfs_nodeget() will be called
 
 

From: "Alexander V. Chernikov" <admin@su29.net>
To: bug-followup@FreeBSD.org, packet@adrenochrome.nl
Cc:  
Subject: Re: kern/117829: [unionfs] can't mount devfs on top of unionfs anymore
 (regression)
Date: Thu, 21 Feb 2008 14:23:06 +0300

 Previous patch version contains errors, this is 'right' one
 
 --- /usr/src/sys/kern/vfs_cache.c.old   2008-02-21 13:01:39.000000000 +0300
 +++ /usr/src/sys/kern/vfs_cache.c       2008-02-21 13:01:43.000000000 +0300
 @@ -602,6 +602,21 @@
         CACHE_UNLOCK();
  }
 
 +/*
 + * Invalidate all entries to a particular vnode
 + * skipping 'upper' nodes and node itself
 + */
 +void
 +cache_purge_skipdst(vp)
 +       struct vnode *vp;
 +{
 +       CTR1(KTR_VFS, "cache_purge_skipdst(%p)", vp);
 +       CACHE_LOCK();
 +       while (!LIST_EMPTY(&vp->v_cache_src))
 +               cache_zap(LIST_FIRST(&vp->v_cache_src));
 +       vp->v_dd = NULL;
 +       CACHE_UNLOCK();
 +}
 
  /*
   * Flush all entries referencing a particular filesystem.
 --- /usr/src/sys/sys/vnode.h.old        2008-02-18 13:42:50.000000000 +0300
 +++ /usr/src/sys/sys/vnode.h    2008-02-18 13:42:52.000000000 +0300
 @@ -564,6 +564,7 @@
  int    cache_lookup(struct vnode *dvp, struct vnode **vpp,
             struct componentname *cnp);
  void   cache_purge(struct vnode *vp);
 +void   cache_purge_skipdst(struct vnode *vp);
  void   cache_purgevfs(struct mount *mp);
  int    change_dir(struct vnode *vp, struct thread *td);
  int    change_root(struct vnode *vp, struct thread *td);
 --- /usr/src/sys/kern/vfs_mount.c.old   2008-02-18 13:43:57.000000000 +0300
 +++ /usr/src/sys/kern/vfs_mount.c       2008-02-18 13:44:05.000000000 +0300
 @@ -1066,7 +1066,7 @@
         /*
          * Put the new filesystem on the mount list after root.
          */
 -       cache_purge(vp);
 +       cache_purge_skipdst(vp);
         if (!error) {
                 struct vnode *newdp;
 
 
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/117829: commit references a PR
Date: Fri, 25 Apr 2008 09:38:53 +0000 (UTC)

 daichi      2008-04-25 09:38:48 UTC
 
   FreeBSD src repository
 
   Modified files:
     sys/fs/unionfs       union.h union_subr.c 
   Log:
     o Fixed inaccessible issue especially including devfs on unionfs case.
       fixed also: kern/117829
   
   PR:             kern/117829
   Submitted by:   Masanori OZAWA (ozawa@ongs.co.jp)
   MFC after:      1 week
   
   Revision  Changes    Path
   1.37      +6 -1      src/sys/fs/unionfs/union.h
   1.102     +181 -7    src/sys/fs/unionfs/union_subr.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: daichi 
State-Changed-When: Wed May 7 08:08:09 UTC 2008 
State-Changed-Why:  
Fixed. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/117829: commit references a PR
Date: Wed,  7 May 2008 08:07:56 +0000 (UTC)

 daichi      2008-05-07 08:07:48 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_7)
     sys/fs/unionfs       union.h union_subr.c 
   Log:
   MFC
   
   Fixed inaccessible issue especially including devfs on unionfs case.
   fixed also: kern/117829
   
   PR:             kern/117829
   Submitted by:   Masanori OZAWA (ozawa@ongs.co.jp)
   
   Revision  Changes    Path
   1.34.2.4  +6 -1      src/sys/fs/unionfs/union.h
   1.92.2.6  +181 -7    src/sys/fs/unionfs/union_subr.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
