Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-10]: src/sys/kern Pull up following revision(s) (requested by mle...



details:   https://anonhg.NetBSD.org/src/rev/b80e7868bfbc
branches:  netbsd-10
changeset: 373620:b80e7868bfbc
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Feb 22 13:28:01 2023 +0000

description:
Pull up following revision(s) (requested by mlelstv in ticket #96):

        sys/kern/kern_subr.c: revision 1.231

If a specified root device does not exist when the kernel tries to
mount the root filesystem, retry for up to ROOT_WAITTIME (20) seconds.

This helps for root on hot-plug devices like USB disks.

diffstat:

 sys/kern/kern_subr.c |  25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diffs (64 lines):

diff -r 88493ff69147 -r b80e7868bfbc sys/kern/kern_subr.c
--- a/sys/kern/kern_subr.c      Wed Feb 22 13:24:05 2023 +0000
+++ b/sys/kern/kern_subr.c      Wed Feb 22 13:28:01 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_subr.c,v 1.230 2022/03/19 13:51:35 hannken Exp $  */
+/*     $NetBSD: kern_subr.c,v 1.230.4.1 2023/02/22 13:28:01 martin Exp $       */
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.230 2022/03/19 13:51:35 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.230.4.1 2023/02/22 13:28:01 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_md.h"
@@ -174,6 +174,13 @@
 char *bootspec;
 
 /*
+ * Time to wait for a specified boot device to appear.
+ */
+#ifndef ROOT_WAITTIME
+#define ROOT_WAITTIME 20
+#endif
+
+/*
  * Use partition letters if it's a disk class but not a wedge or flash.
  * XXX Check for wedge/flash is kinda gross.
  */
@@ -185,6 +192,7 @@
 void
 setroot(device_t bootdv, int bootpartition)
 {
+       time_t waitend;
 
        /*
         * Let bootcode augment "rootspec", ensure that
@@ -241,14 +249,19 @@
        /*
         * loop until a root device is specified
         */
+       waitend = time_uptime + ROOT_WAITTIME;
        do {
                if (boothowto & RB_ASKNAME)
                        setroot_ask(bootdv, bootpartition);
-               else
+               else {
                        setroot_root(bootdv, bootpartition);
-
-               if (root_device == NULL)
-                       boothowto |= RB_ASKNAME;
+                       if (root_device == NULL) {
+                               if (time_uptime < waitend) {
+                                       kpause("root", false, hz, NULL);
+                               } else
+                                       boothowto |= RB_ASKNAME;
+                       }
+               }
        } while (root_device == NULL);
 }
 



Home | Main Index | Thread Index | Old Index