Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Mar 2017 10:34:27 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r315539 - stable/11/sys/kern
Message-ID:  <201703191034.v2JAYRb8068814@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Sun Mar 19 10:34:26 2017
New Revision: 315539
URL: https://svnweb.freebsd.org/changeset/base/315539

Log:
  MFC r313350:
  
  In r290196 the root mount hold mechanism was changed to make it not wait
  for mount hold release if the root device already exists.  So, unless your
  rootdev is not on USB - ie in the usual case - the root mount won't wait
  for USB.  However, the old behaviour was sometimes used as "wait until USB
  is fully enumerated", and r290196 broke that.
  
  This commit adds vfs.root_mount_always_wait tunable, to force the kernel
  to always wait for root mount holds, even if the root is already there.
  
  Relnotes:	yes

Modified:
  stable/11/sys/kern/vfs_mountroot.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/vfs_mountroot.c
==============================================================================
--- stable/11/sys/kern/vfs_mountroot.c	Sun Mar 19 10:32:39 2017	(r315538)
+++ stable/11/sys/kern/vfs_mountroot.c	Sun Mar 19 10:34:26 2017	(r315539)
@@ -132,6 +132,11 @@ static int root_mount_complete;
 static int root_mount_timeout = 3;
 TUNABLE_INT("vfs.mountroot.timeout", &root_mount_timeout);
 
+static int root_mount_always_wait = 0;
+SYSCTL_INT(_vfs, OID_AUTO, root_mount_always_wait, CTLFLAG_RDTUN,
+    &root_mount_always_wait, 0,
+    "Wait for root mount holds even if the root device already exists");
+
 SYSCTL_PROC(_vfs, OID_AUTO, root_mount_hold,
     CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
     NULL, 0, sysctl_vfs_root_mount_hold, "A",
@@ -961,10 +966,11 @@ vfs_mountroot_wait_if_neccessary(const c
 
 	/*
 	 * In case of ZFS and NFS we don't have a way to wait for
-	 * specific device.
+	 * specific device.  Also do the wait if the user forced that
+	 * behaviour by setting vfs.root_mount_always_wait=1.
 	 */
 	if (strcmp(fs, "zfs") == 0 || strstr(fs, "nfs") != NULL ||
-	    dev[0] == '\0') {
+	    dev[0] == '\0' || root_mount_always_wait != 0) {
 		vfs_mountroot_wait();
 		return (0);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703191034.v2JAYRb8068814>