svn commit: r364817 - head/libexec/rc/rc.d

Cy Schubert cy at FreeBSD.org
Wed Aug 26 13:13:59 UTC 2020


Author: cy
Date: Wed Aug 26 13:13:57 2020
New Revision: 364817
URL: https://svnweb.freebsd.org/changeset/base/364817

Log:
  As of r364746 (OpenZFS import) existing ZPOOLs are not imported
  prior to zvol and mountcritlocal resulting in ZVOLs (swap and
  virtual machine UFS filesystems) being unavailable, leading to
  boot failures.
  
  We move the zpool import from zfs to a new zpool script, with the
  -N option to avoid mounting datasets while making the ZPOOL's
  datasets available for "legacy" mount (mountpoint=legacy) and ZVOLs
  available for subsequent use for swap (in the zvol rc sript) or
  for UFS or other filesystems in fstab(5), mounted by mountcritlocal.
  
  Reviewed by:		freqlabs (previous version)
  Differential Revision:	https://reviews.freebsd.org/D26185

Added:
  head/libexec/rc/rc.d/zpool   (contents, props changed)
Modified:
  head/libexec/rc/rc.d/Makefile
  head/libexec/rc/rc.d/mountcritlocal
  head/libexec/rc/rc.d/zfs
  head/libexec/rc/rc.d/zvol

Modified: head/libexec/rc/rc.d/Makefile
==============================================================================
--- head/libexec/rc/rc.d/Makefile	Wed Aug 26 12:54:18 2020	(r364816)
+++ head/libexec/rc/rc.d/Makefile	Wed Aug 26 13:13:57 2020	(r364817)
@@ -318,6 +318,7 @@ CONFGROUPS+=	ZFS
 ZFS+=		zfs
 ZFS+=		zfsbe
 ZFS+=		zfsd
+ZFS+=		zpool
 ZFS+=		zvol
 .endif
 

Modified: head/libexec/rc/rc.d/mountcritlocal
==============================================================================
--- head/libexec/rc/rc.d/mountcritlocal	Wed Aug 26 12:54:18 2020	(r364816)
+++ head/libexec/rc/rc.d/mountcritlocal	Wed Aug 26 13:13:57 2020	(r364817)
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: mountcritlocal
-# REQUIRE: root hostid_save mdconfig
+# REQUIRE: root hostid_save mdconfig zvol
 # KEYWORD: nojail shutdown
 
 . /etc/rc.subr

Modified: head/libexec/rc/rc.d/zfs
==============================================================================
--- head/libexec/rc/rc.d/zfs	Wed Aug 26 12:54:18 2020	(r364816)
+++ head/libexec/rc/rc.d/zfs	Wed Aug 26 13:13:57 2020	(r364817)
@@ -25,13 +25,6 @@ zfs_start_jail()
 
 zfs_start_main()
 {
-	local cachefile
-
-	for cachefile in /boot/zfs/zpool.cache /etc/zfs/zpool.cache; do
-		if [ -r $cachefile ]; then
-			zpool import -c $cachefile -a
-		fi
-	done
 	zfs mount -va
 	zfs share -a
 	if [ ! -r /etc/zfs/exports ]; then

Added: head/libexec/rc/rc.d/zpool
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/libexec/rc/rc.d/zpool	Wed Aug 26 13:13:57 2020	(r364817)
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: zpool
+# REQUIRE: hostid
+# BEFORE: zvol mountcritlocal
+# KEYWORD: nojail
+
+. /etc/rc.subr
+
+name="zpool"
+desc="Import ZPOOLs"
+rcvar="zfs_enable"
+start_cmd="zpool_start"
+required_modules="zfs"
+
+zpool_start()
+{
+	local cachefile
+
+	for cachefile in /boot/zfs/zpool.cache /etc/zfs/zpool.cache; do
+		if [ -r $cachefile ]; then
+			zpool import -c $cachefile -a -N
+		fi
+	done
+}
+
+load_rc_config $name
+run_rc_command "$1"

Modified: head/libexec/rc/rc.d/zvol
==============================================================================
--- head/libexec/rc/rc.d/zvol	Wed Aug 26 12:54:18 2020	(r364816)
+++ head/libexec/rc/rc.d/zvol	Wed Aug 26 13:13:57 2020	(r364817)
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: zvol
-# REQUIRE: hostid
+# REQUIRE: zpool
 # BEFORE: dumpon
 # KEYWORD: nojail
 


More information about the svn-src-head mailing list