Subject: Re: amd64 kernel not identifying root filesystem
To: Andrew Doran <ad@netbsd.org>
From: Matt Fleming <mjf@netbsd.org>
List: current-users
Date: 02/02/2008 15:45:21
--WIyZ46R2i8wDzkSu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sat, Feb 02, 2008 at 03:04:12PM +0000, Andrew Doran wrote:
> On Sat, Feb 02, 2008 at 02:22:21PM +0000, David Laight wrote:
> > On Mon, Jan 28, 2008 at 11:15:11AM +0000, David Laight wrote:
> > > On Sun, Jan 27, 2008 at 06:38:36PM +0000, David Laight wrote:
> > > > A moderately recent 'current' amd64 kernel (I think from source from
> > > > saturday) is failing to determine the correct boot device.
> > > > 
> > > > It gives:
> > > > opendisk: can't open dev wd0 (16)
> > > > opendisk: can't open dev wd0 (16)
> > > > opendisk: can't open dev wd0 (16)
> > > > boot device: <unknown>
> > > > 
> > > > This is a ASUS A8V delux.
> > > 
> > > Some investigation shows that this is (probably) fallout from ad's
> > > change to disallow multiple specfs_open() of block devices.
> > 
> > This still fails on a 4.99.52 kernel.
> 
> I've been looking and can't see the problem. What's the common factor here,
> is it wedges?
> 
> Thanks,
> Andrew

Attached is a patch that fixes this for me. There was also a panic that
occurred later on from the assertion in spec_node_destroy() that opencnt
was 0, this patch fixes it.

If you give the OK, I'll commit it.

--mjf

--WIyZ46R2i8wDzkSu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ata.patch"

Index: ata_raid_adaptec.c
===================================================================
RCS file: /repo/src/sys/dev/ata/ata_raid_adaptec.c,v
retrieving revision 1.6
diff -u -r1.6 ata_raid_adaptec.c
--- ata_raid_adaptec.c	26 Nov 2007 19:01:36 -0000	1.6
+++ ata_raid_adaptec.c	2 Feb 2008 14:54:19 -0000
@@ -94,6 +94,7 @@
 
 	error = ata_raid_config_block_rw(vp, ADP_LBA(sc), info,
 	    sizeof(*info), B_READ);
+	VOP_CLOSE(vp, FREAD, NOCRED);
 	vput(vp);
 	if (error) {
 		printf("%s: error %d reading Adaptec config block\n",
Index: ata_raid_promise.c
===================================================================
RCS file: /repo/src/sys/dev/ata/ata_raid_promise.c,v
retrieving revision 1.9
diff -u -r1.9 ata_raid_promise.c
--- ata_raid_promise.c	26 Nov 2007 19:01:36 -0000	1.9
+++ ata_raid_promise.c	2 Feb 2008 14:59:47 -0000
@@ -94,6 +94,7 @@
 
 	error = ata_raid_config_block_rw(vp, PR_LBA(sc), info,
 	    sizeof(*info), B_READ);
+	VOP_CLOSE(vp, FREAD, NOCRED);
 	vput(vp);
 	if (error) {
 		printf("%s: error %d reading Promise config block\n",
Index: ata_raid_via.c
===================================================================
RCS file: /repo/src/sys/dev/ata/ata_raid_via.c,v
retrieving revision 1.2
diff -u -r1.2 ata_raid_via.c
--- ata_raid_via.c	26 Nov 2007 19:01:36 -0000	1.2
+++ ata_raid_via.c	2 Feb 2008 15:00:04 -0000
@@ -143,6 +143,7 @@
 
 	error = ata_raid_config_block_rw(vp, VIA_LBA(sc), info,
 	    sizeof(*info), B_READ);
+	VOP_CLOSE(vp, FREAD, NOCRED);
 	vput(vp);
 	if (error) {
 		printf("%s: error %d reading VIA V-RAID config block\n",

--WIyZ46R2i8wDzkSu--