Subject: bin/13569: mbrlabel-generated disklabel lost when last descriptor for disk is closed
To: None <gnats-bugs@gnats.netbsd.org>
From: Laine Stump <lainestump@rcn.com>
List: netbsd-bugs
Date: 07/27/2001 12:52:48
>Number:         13569
>Category:       bin
>Synopsis:       mbrlabel-generated disklabel lost when last descriptor for disk is closed
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 27 09:50:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Laine Stump
>Release:        2001-07-24
>Organization:

>Environment:
	
System: NetBSD idris.laine.org 1.5W NetBSD 1.5W (GENERIC-lrs) #0: Wed Jun 20 14:25:19 EDT 2001 laine@idris.laine.org:/drive2/src/src/sys/arch/i386/compile/GENERIC-lrs i386
Architecture: i386
Machine: i386
>Description:

Running mbrlabel -w wd1 is supposed to created a disklabel for wd1
containing all the DOS partitions (primary and extended) on the disk
and save it to the incore image of the disklabel. However, if there
are no file descriptors open on the disk, this new disklabel is lost,
and subsequent runs of "disklabel wd1" show the original disklabel
containing only the primary DOS partition.

>How-To-Repeat:

Install a secondary drive as wd1 which has multiple DOS partitions. Once NetBSD has booted from the primary disk, run:

     mbrlabel -w wd1
     disklabel wd1

Notice that the output of disklabel is missing all the extended partition info that mbrlabel said it was writing to the in-core disklabel.

Now open another xterm and run:

     sleep 3600 </dev/wd1d

then go back to the other window and run the first two commands
again. Notice that the new info from mbrlabel *is* reported by
disklabel. Finally, ctl-C the sleep command, then run disklabel again - notice that it has reverted to the original disklabel.

>Fix:

According to Manuel Bouyer: "It looks like mbrlabel should issue a
DIOCKLABEL ioctl, so that the label is keept after last close." I
haven't tried this.
>Release-Note:
>Audit-Trail:
>Unformatted: