summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>1998-03-11 00:10:31 +0000
committermsmith <msmith@FreeBSD.org>1998-03-11 00:10:31 +0000
commit46304bfe5a3c7beb586dc61aff63d7190373e424 (patch)
treee87d9f05e9867c87a8e23528e3c021e62cec0443
parent56e6dd5935c908c873cb2b9a2af503c6fa01c26a (diff)
downloadFreeBSD-src-46304bfe5a3c7beb586dc61aff63d7190373e424.zip
FreeBSD-src-46304bfe5a3c7beb586dc61aff63d7190373e424.tar.gz
If the root mount fails from a device that is not the compatability slice
of a disk, because that slice does not exist, try again mounting from the compatability slice. This handles the case where a disk has been initialised by 'disklabel auto', which places a bogus and invalid slice entry on the disk. The bootstrap is not smart enough to reject this slice, and pretends to boot from it. Believing the the bootstrap at this point is unwise. Booting from non-'wd' disks thus prepared is still broken, as 'disklabel -rwB xdN auto' does not initialise the disk type field, and the bootstrap mistakenly claims that the disk is handled by 'wd'. Behaviour is now consistent with DEVFS expected characteristics.
-rw-r--r--sys/kern/vfs_conf.c14
-rw-r--r--sys/kern/vfs_mount.c14
2 files changed, 26 insertions, 2 deletions
diff --git a/sys/kern/vfs_conf.c b/sys/kern/vfs_conf.c
index 56fb1b9..a42a89a 100644
--- a/sys/kern/vfs_conf.c
+++ b/sys/kern/vfs_conf.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_conf.c 8.8 (Berkeley) 3/31/94
- * $Id: vfs_conf.c,v 1.20 1998/01/09 03:21:01 eivind Exp $
+ * $Id: vfs_conf.c,v 1.21 1998/02/09 06:09:32 eivind Exp $
*/
/*
@@ -135,6 +135,18 @@ vfs_mountrootfs(void *unused)
* Attempt the mount
*/
err = VFS_MOUNT(mp, NULL, NULL, NULL, p);
+ /*
+ * rootdev may be bogus (slice field may be incorrect for disks)
+ * If slice field is nonzero, clear and retry.
+ *
+ * XXX Implicit knowledge of device minor number layout.
+ * This is placeholder code until saner root mounts arrive with
+ * DEVFS.
+ */
+ if ((err == ENXIO) && (rootdev & 0xff0000)) {
+ rootdev &= ~0xff0000;
+ err = VFS_MOUNT(mp, NULL, NULL, NULL, p);
+ }
if (err) {
vfs_unbusy(mp, p);
/*
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 56fb1b9..a42a89a 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_conf.c 8.8 (Berkeley) 3/31/94
- * $Id: vfs_conf.c,v 1.20 1998/01/09 03:21:01 eivind Exp $
+ * $Id: vfs_conf.c,v 1.21 1998/02/09 06:09:32 eivind Exp $
*/
/*
@@ -135,6 +135,18 @@ vfs_mountrootfs(void *unused)
* Attempt the mount
*/
err = VFS_MOUNT(mp, NULL, NULL, NULL, p);
+ /*
+ * rootdev may be bogus (slice field may be incorrect for disks)
+ * If slice field is nonzero, clear and retry.
+ *
+ * XXX Implicit knowledge of device minor number layout.
+ * This is placeholder code until saner root mounts arrive with
+ * DEVFS.
+ */
+ if ((err == ENXIO) && (rootdev & 0xff0000)) {
+ rootdev &= ~0xff0000;
+ err = VFS_MOUNT(mp, NULL, NULL, NULL, p);
+ }
if (err) {
vfs_unbusy(mp, p);
/*
OpenPOWER on IntegriCloud