Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Nov 2009 02:45:50 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r199853 - stable/8/sys/kern
Message-ID:  <200911270245.nAR2jof9099628@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Fri Nov 27 02:45:50 2009
New Revision: 199853
URL: http://svn.freebsd.org/changeset/base/199853

Log:
  MFC r199227:
  Add the possibility for vfs.root.mountfrom tunable to accept a list of
  items rather than a single one.
  While there fix also a nit in a comment.
  
  Sponsored by:	Sandvine Incorporated

Modified:
  stable/8/sys/kern/vfs_mount.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/kern/vfs_mount.c
==============================================================================
--- stable/8/sys/kern/vfs_mount.c	Fri Nov 27 01:02:17 2009	(r199852)
+++ stable/8/sys/kern/vfs_mount.c	Fri Nov 27 02:45:50 2009	(r199853)
@@ -104,13 +104,17 @@ struct vnode	*rootvnode;
  * The root filesystem is detailed in the kernel environment variable
  * vfs.root.mountfrom, which is expected to be in the general format
  *
- * <vfsname>:[<path>]
+ * <vfsname>:[<path>][	<vfsname>:[<path>] ...]
  * vfsname   := the name of a VFS known to the kernel and capable
  *              of being mounted as root
  * path      := disk device name or other data used by the filesystem
  *              to locate its physical store
  *
- * The environment variable vfs.root.mountfrom options is a comma delimited
+ * If the environment variable vfs.root.mountfrom is a space separated list,
+ * each list element is tried in turn and the root filesystem will be mounted
+ * from the first one that suceeds.
+ *
+ * The environment variable vfs.root.mountfrom.options is a comma delimited
  * set of string mount options.  These mount options must be parseable
  * by nmount() in the kernel.
  */
@@ -1643,7 +1647,7 @@ vfs_opterror(struct vfsoptlist *opts, co
 void
 vfs_mountroot(void)
 {
-	char *cp, *options;
+	char *cp, *cpt, *options, *tmpdev;
 	int error, i, asked = 0;
 
 	options = NULL;
@@ -1695,10 +1699,15 @@ vfs_mountroot(void)
 	 */
 	cp = getenv("vfs.root.mountfrom");
 	if (cp != NULL) {
-		error = vfs_mountroot_try(cp, options);
+		cpt = cp;
+		while ((tmpdev = strsep(&cpt, " \t")) != NULL) {
+			error = vfs_mountroot_try(tmpdev, options);
+			if (error == 0) {
+				freeenv(cp);
+				goto mounted;
+			}
+		}
 		freeenv(cp);
-		if (!error)
-			goto mounted;
 	}
 
 	/*



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