From dima@tejblum.dnttm.rssi.ru  Tue Aug 26 08:18:10 1997
Received: from helios.dnttm.ru (root@dnttm.wave.ras.ru [194.85.104.197])
          by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id IAA16201;
          Tue, 26 Aug 1997 08:18:03 -0700 (PDT)
Received: (from uucp@localhost)
	by helios.dnttm.ru (8.8.5/8.8.5/IP-3) with UUCP id TAA21354;
	Tue, 26 Aug 1997 19:16:17 +0400
Received: (from dima@localhost)
	by tejblum.dnttm.rssi.ru (8.8.7/8.8.5) id TAA00594;
	Tue, 26 Aug 1997 19:10:50 +0400 (MSD)
Message-Id: <199708261510.TAA00594@tejblum.dnttm.rssi.ru>
Date: Tue, 26 Aug 1997 19:10:50 +0400 (MSD)
From: Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>
Reply-To: dima@tejblum.dnttm.rssi.ru
To: FreeBSD-gnats-submit@freebsd.org
Cc: julian@freebsd.org
Subject: DEVFS: new devices on the 'backing plane' never propagated to 'front planes'
X-Send-Pr-Version: 3.2

>Number:         4396
>Category:       kern
>Synopsis:       DEVFS: new devices on the 'backing plane' never propagated to 'front planes'
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    steve
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 26 08:20:01 PDT 1997
>Closed-Date:    Tue Aug 26 20:11:08 PDT 1997
>Last-Modified:  Tue Aug 26 20:12:55 PDT 1997
>Originator:     Dmitrij Tejblum
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
>Environment:


>Description:

Function 'devfs_propogate' should do the propagation. It tryes to iterate 
front planes with the following cycl:

	for (adnp = pdnp->nextsibling;
		adnp != pdnp->nextsibling;
 		adnp = adnp->nextsibling)

Obvious, the cycl will never run, because after adnp = pdnp->nextsibling 
condition adnp != pdnp->nextsibling cannot be true.

>How-To-Repeat:

You can rproduce the problem with the vn device:

Create a big zero-filled file.
Mount a DEVFS somewhere.
Set 'labels' option to a vn device: vnconfig -s labels /dev/vn0
Attach the file to the vn device: vnconfig -c /dev/vn0 /usr/fsimage
Disklabel the device: disklabel -Brw vn0 auto
See that vn0c didn't appeared in the DEVFS.

If you already have disklabeled disk image, you may simple do:
vnconfig -s labels /dev/vn0
vnconfig -c /dev/vn0 /usr/fsimage
and see if it's partitions appeared in the DEVFS.

(Unfortunately, even with the following fix, after 
vnconfig -s labels -c /dev/vn0 /usr/fsimage
partitions don't appeared in DEVFS. 
2 separate command, as above, should be used. 
It is a bug in vnconfig/vn device)

>Fix:
	
--- devfs_tree.c.00	Thu Jul 17 15:12:23 1997
+++ devfs_tree.c	Mon Aug 25 23:57:48 1997
@@ -543,7 +543,7 @@
 	* Find the other instances of the parent node	*
 	\***********************************************/
 	for (adnp = pdnp->nextsibling;
-		adnp != pdnp->nextsibling;
+		adnp != pdnp;
 		adnp = adnp->nextsibling)
 	{
 		/*
@@ -551,7 +551,7 @@
 		 * if the node already exists on that plane it won't be
 		 * re-made..
 		 */
-		if ( error = dev_add_entry(child->name, pdnp, type,
+		if ( error = dev_add_entry(child->name, adnp, type,
 					NULL, dnp, adnp->dvm, &newnmp)) {
 			printf("duplicating %s failed\n",child->name);
 		}

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: steve 
State-Changed-When: Tue Aug 26 20:11:08 PDT 1997 
State-Changed-Why:  
Patch applied by Julian Elischer in revision 1.38 
of /src/sys/miscfs/devfs/devfs_tree.c.  Thanks! 
>Unformatted:
