Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Jun 2019 18:47:40 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349383 - head/lib/libbe
Message-ID:  <201906251847.x5PIlecl061819@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Tue Jun 25 18:47:40 2019
New Revision: 349383
URL: https://svnweb.freebsd.org/changeset/base/349383

Log:
  libbe(3): restructure be_mount, skip canmount check for BE dataset
  
  Further cleanup after r349380; loader and kernel will both ignore canmount
  on the root dataset as well, so we should not be so strict about it when
  mounting it. be_mount is restructured to make it more clear that depth==0 is
  special, and to not try fetching these properties that we won't care about.
  
  MFC after:	3 days

Modified:
  head/lib/libbe/be_access.c

Modified: head/lib/libbe/be_access.c
==============================================================================
--- head/lib/libbe/be_access.c	Tue Jun 25 18:36:11 2019	(r349382)
+++ head/lib/libbe/be_access.c	Tue Jun 25 18:47:40 2019	(r349383)
@@ -89,25 +89,31 @@ be_mount_iter(zfs_handle_t *zfs_hdl, void *data)
 		return (0);
 	}
 
-	if (zfs_prop_get_int(zfs_hdl, ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_OFF)
-		return (0);
+	/*
+	 * canmount and mountpoint are both ignored for the BE dataset, because
+	 * the rest of the system (kernel and loader) will effectively do the
+	 * same.
+	 */
+	if (info->depth == 0) {
+		snprintf(tmp, BE_MAXPATHLEN, "%s", info->mountpoint);
+	} else {
+		if (zfs_prop_get_int(zfs_hdl, ZFS_PROP_CANMOUNT) ==
+		    ZFS_CANMOUNT_OFF)
+			return (0);
 
-	if (zfs_prop_get(zfs_hdl, ZFS_PROP_MOUNTPOINT, zfs_mnt, BE_MAXPATHLEN,
-	    NULL, NULL, 0, 1))
-		return (1);
+		if (zfs_prop_get(zfs_hdl, ZFS_PROP_MOUNTPOINT, zfs_mnt,
+		    BE_MAXPATHLEN, NULL, NULL, 0, 1))
+			return (1);
 
-	if (strcmp("none", zfs_mnt) == 0 || info->depth == 0) {
 		/*
-		 * mountpoint=none; we'll mount it at info->mountpoint assuming
-		 * we're at the root.  If we're not at the root, we're likely
-		 * at some intermediate dataset (e.g. zroot/var) that will have
-		 * children that may need to be mounted.
+		 * We've encountered mountpoint=none at some intermediate
+		 * dataset (e.g. zroot/var) that will have children that may
+		 * need to be mounted.  Skip mounting it, but iterate through
+		 * the children.
 		 */
-		if (info->depth > 0)
+		if (strcmp("none", zfs_mnt) == 0)
 			goto skipmount;
 
-		snprintf(tmp, BE_MAXPATHLEN, "%s", info->mountpoint);
-	} else {
 		mountpoint = be_mountpoint_augmented(info->lbh, zfs_mnt);
 		snprintf(tmp, BE_MAXPATHLEN, "%s%s", info->mountpoint,
 		    mountpoint);



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