From c270875f7cd8409129048a245a25c5a1c43bddc9 Mon Sep 17 00:00:00 2001 From: Suleiman Souhlal Date: Sat, 28 Jan 2006 22:58:39 +0000 Subject: [PATCH] Don't try to load KLDs if we're mounting the root. We'd otherwise panic. Tested by: kris MFC after: 3 days --- sys/kern/vfs_mount.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 4b57575c24bb..2015a434e65c 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -818,10 +818,18 @@ vfs_domount( vput(vp); return (ENOTDIR); } - vfsp = vfs_byname_kld(fstype, td, &error); - if (vfsp == NULL) { - vput(vp); - return (error); + /* Don't try to load KLDs if we're mounting the root. */ + if (fsflags & MNT_ROOTFS) { + if ((vfsp = vfs_byname(fstype)) == NULL) { + vput(vp); + return (ENODEV); + } + } else { + vfsp = vfs_byname_kld(fstype, td, &error); + if (vfsp == NULL) { + vput(vp); + return (error); + } } VI_LOCK(vp); if ((vp->v_iflag & VI_MOUNT) != 0 ||