From owner-svn-src-all@freebsd.org Wed Aug 26 13:13:59 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4901E3D4D21; Wed, 26 Aug 2020 13:13:59 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bc5sg1BDGz40Pm; Wed, 26 Aug 2020 13:13:59 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BDDA13741; Wed, 26 Aug 2020 13:13:59 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07QDDwBE040124; Wed, 26 Aug 2020 13:13:58 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07QDDwRm040119; Wed, 26 Aug 2020 13:13:58 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202008261313.07QDDwRm040119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 26 Aug 2020 13:13:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364817 - head/libexec/rc/rc.d X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/libexec/rc/rc.d X-SVN-Commit-Revision: 364817 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 13:13:59 -0000 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