From 0a13c0f2f6eea459daeae0e31aab75ee86f1874e Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 8 Mar 2002 10:33:11 +0000 Subject: [PATCH] Move the mount of the root filesystem to happen in the init process before the exec if /sbin/init. This allows the scheduler to get started and kthreads a chance to run before we start filesystem operations. --- sys/kern/init_main.c | 2 ++ sys/kern/vfs_conf.c | 7 ++----- sys/kern/vfs_mount.c | 7 ++----- sys/sys/mount.h | 1 + 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 781666696600..e847534ab92b 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -487,6 +487,8 @@ start_init(void *dummy) td = curthread; p = td->td_proc; + vfs_mountroot(NULL); + /* Get the vnode for '/'. Set p->p_fd->fd_cdir to reference it. */ if (VFS_ROOT(TAILQ_FIRST(&mountlist), &rootvnode)) panic("cannot find root vnode"); diff --git a/sys/kern/vfs_conf.c b/sys/kern/vfs_conf.c index 27c2b54b3c4e..0f1ab0087e47 100644 --- a/sys/kern/vfs_conf.c +++ b/sys/kern/vfs_conf.c @@ -87,7 +87,6 @@ static char *cdrom_rootdevnames[] = { NULL }; -static void vfs_mountroot(void *junk); static int vfs_mountroot_try(char *mountfrom); static int vfs_mountroot_ask(void); static void gets(char *cp); @@ -96,13 +95,11 @@ static void gets(char *cp); char *rootdevnames[2] = {NULL, NULL}; static int setrootbyname(char *name); -SYSINIT(mountroot, SI_SUB_MOUNT_ROOT, SI_ORDER_SECOND, vfs_mountroot, NULL); - /* * Find and mount the root filesystem */ -static void -vfs_mountroot(void *junk) +void +vfs_mountroot(void *foo __unused) { int i; diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 27c2b54b3c4e..0f1ab0087e47 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -87,7 +87,6 @@ static char *cdrom_rootdevnames[] = { NULL }; -static void vfs_mountroot(void *junk); static int vfs_mountroot_try(char *mountfrom); static int vfs_mountroot_ask(void); static void gets(char *cp); @@ -96,13 +95,11 @@ static void gets(char *cp); char *rootdevnames[2] = {NULL, NULL}; static int setrootbyname(char *name); -SYSINIT(mountroot, SI_SUB_MOUNT_ROOT, SI_ORDER_SECOND, vfs_mountroot, NULL); - /* * Find and mount the root filesystem */ -static void -vfs_mountroot(void *junk) +void +vfs_mountroot(void *foo __unused) { int i; diff --git a/sys/sys/mount.h b/sys/sys/mount.h index b6099d139ca2..5cd748dca4b9 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -431,6 +431,7 @@ dev_t vfs_getrootfsid __P((struct mount *)); struct mount *vfs_getvfs __P((fsid_t *)); /* return vfs given fsid */ int vfs_modevent __P((module_t, int, void *)); int vfs_mountedon __P((struct vnode *)); /* is a vfs mounted on vp */ +void vfs_mountroot __P((void *)); /* mount our root filesystem */ int vfs_rootmountalloc __P((char *, char *, struct mount **)); void vfs_unbusy __P((struct mount *, struct thread *td)); void vfs_unmountall __P((void));