Please test by applying and rebooting on machines with lot of disks.
I so far have only seen a few test results for amd64, sparc64 & sgi. I
need all arches tested.
Index: subr_disk.c
===================================================================
RCS file: /cvs/src/sys/kern/subr_disk.c,v
retrieving revision 1.95
diff -u -p -r1.95 subr_disk.c
--- subr_disk.c 17 Jun 2009 01:30:30 -0000 1.95
+++ subr_disk.c 5 Aug 2009 15:47:40 -0000
@@ -56,6 +56,7 @@
#include <sys/dkio.h>
#include <sys/dkstat.h> /* XXX */
#include <sys/proc.h>
+#include <sys/vnode.h>
#include <uvm/uvm_extern.h>
#include <sys/socket.h>
@@ -910,6 +911,7 @@ dk_mountroot(void)
int part = DISKPART(rootdev);
int (*mountrootfn)(void);
struct disklabel dl;
+ struct vnode *vn;
int error;
rrootdev = blktochr(rootdev);
@@ -922,18 +924,21 @@ dk_mountroot(void)
/*
* open device, ioctl for the disklabel, and close it.
*/
- error = (cdevsw[major(rrootdev)].d_open)(rawdev, FREAD,
- S_IFCHR, curproc);
+ if (cdevvp(rawdev, &vn))
+ panic("cannot obtain vnode for 0x%x/0x%x", rootdev, rrootdev);
+ error = VOP_OPEN(vn, FREAD, NOCRED, curproc);
if (error)
panic("cannot open disk, 0x%x/0x%x, error %d",
rootdev, rrootdev, error);
- error = (cdevsw[major(rrootdev)].d_ioctl)(rawdev, DIOCGDINFO,
- (caddr_t)&dl, FREAD, curproc);
+ error = VOP_IOCTL(vn, DIOCGDINFO, (caddr_t)&dl, FREAD, NOCRED, 0);
if (error)
panic("cannot read disk label, 0x%x/0x%x, error %d",
rootdev, rrootdev, error);
- (void) (cdevsw[major(rrootdev)].d_close)(rawdev, FREAD,
- S_IFCHR, curproc);
+ error = VOP_CLOSE(vn, FREAD, NOCRED, 0);
+ if (error)
+ panic("cannot close disk , 0x%x/0x%x, error %d",
+ rootdev, rrootdev, error);
+ vput(vn);
if (DL_GETPSIZE(&dl.d_partitions[part]) == 0)
panic("root filesystem has size 0");