From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 476C792DE4 for ; Mon, 2 Jan 2023 15:26:08 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 27D55157E for ; Mon, 2 Jan 2023 15:26:08 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 2 Jan 2023 15:26:04 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 4DA7044F73 for ; Mon, 2 Jan 2023 15:26:04 +0100 (CET) From: Stoiko Ivanov To: pve-devel@lists.proxmox.com Date: Mon, 2 Jan 2023 15:25:49 +0100 Message-Id: <20230102142549.728593-1-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.108 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment PROLO_LEO1 0.1 Meta Catches all Leo drug variations so far SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH zfsonlinux] fix #4440: cherry-pick patch for mountpoint=legacy on / X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2023 14:26:08 -0000 As reported having set 'mountpoint=legacy' on the root dataset (for a default install this would be 'rpool/ROOT/pve-1') for mounting through e.g. /etc/fstab breaks booting in initramfs The cherry-picked patch is already applied to zfs-2.1.8-staging upstream so will be included in the next zfs point release. reproduced the issue on a VM with ZFS on root by: * booting into a PVE 7.3 iso (to have zfs and an inactive rpool/ROOT/pve-1) * `zpool import -ocachefile=none -N -f rpool * `zfs set mountpoint=legacy rpool/ROOT/pve-1` * `mount -t zfs rpool/ROOT/pve-1 /mnt * `echo "rpool/ROOT/pve-1 / zfs defaults 0 0" >> /mnt/etc/fstab` * `zpool export rpool` * reboot - the boot breaks with zfs-initramfs 2.1.7-pve1 but works with this patch applied Signed-off-by: Stoiko Ivanov --- The current changes on zfs-2.1.8-staging could all be applied without too much expected fallout (dracut fixes, aarch64 fixes, tests and testconfig) If preferred I can send an update of the zfsmodule to the current tip of this branch instead ...itramfs-Fix-legacy-mountpoint-rootfs.patch | 58 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 59 insertions(+) create mode 100644 debian/patches/0012-initramfs-Fix-legacy-mountpoint-rootfs.patch diff --git a/debian/patches/0012-initramfs-Fix-legacy-mountpoint-rootfs.patch b/debian/patches/0012-initramfs-Fix-legacy-mountpoint-rootfs.patch new file mode 100644 index 00000000..e26941d2 --- /dev/null +++ b/debian/patches/0012-initramfs-Fix-legacy-mountpoint-rootfs.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ryan Moeller +Date: Mon, 12 Dec 2022 13:23:06 -0500 +Subject: [PATCH] initramfs: Fix legacy mountpoint rootfs + +Legacy mountpoint datasets should not pass `-o zfsutil` to `mount.zfs`. +Fix the logic in `mount_fs()` to not forget we have a legacy mountpoint +when checking for an `org.zol:mountpoint` userprop. + +Reviewed-by: Richard Yao +Reviewed-by: Brian Behlendorf +Signed-off-by: Ryan Moeller +Closes #14274 +(cherry picked from commit 786ff6a6cb33226b4f4292c7569b9093286f74d9) +(cherry picked from commit f28c7302cb77a8cb6112690d0eed0bf4adeeae15) +Signed-off-by: Stoiko Ivanov +--- + contrib/initramfs/scripts/zfs | 20 ++++++++------------ + 1 file changed, 8 insertions(+), 12 deletions(-) + +diff --git a/contrib/initramfs/scripts/zfs b/contrib/initramfs/scripts/zfs +index 9169adf5f..c7548fa07 100644 +--- a/contrib/initramfs/scripts/zfs ++++ b/contrib/initramfs/scripts/zfs +@@ -331,25 +331,21 @@ mount_fs() + # Can't use the mountpoint property. Might be one of our + # clones. Check the 'org.zol:mountpoint' property set in + # clone_snap() if that's usable. +- mountpoint=$(get_fs_value "$fs" org.zol:mountpoint) +- if [ "$mountpoint" = "legacy" ] || +- [ "$mountpoint" = "none" ] || +- [ "$mountpoint" = "-" ] ++ mountpoint1=$(get_fs_value "$fs" org.zol:mountpoint) ++ if [ "$mountpoint1" = "legacy" ] || ++ [ "$mountpoint1" = "none" ] || ++ [ "$mountpoint1" = "-" ] + then + if [ "$fs" != "${ZFS_BOOTFS}" ]; then + # We don't have a proper mountpoint and this + # isn't the root fs. + return 0 +- else +- # Last hail-mary: Hope 'rootmnt' is set! +- mountpoint="" + fi +- fi +- +- # If it's not a legacy filesystem, it can only be a +- # native one... +- if [ "$mountpoint" = "legacy" ]; then + ZFS_CMD="mount.zfs" ++ # Last hail-mary: Hope 'rootmnt' is set! ++ mountpoint="" ++ else ++ mountpoint="$mountpoint1" + fi + fi + diff --git a/debian/patches/series b/debian/patches/series index d2770d39..50ec4e77 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -9,3 +9,4 @@ 0009-Patch-move-manpage-arcstat-1-to-arcstat-8.patch 0010-arcstat-Fix-integer-division-with-python3.patch 0011-arc-stat-summary-guard-access-to-l2arc-MFU-MRU-stats.patch +0012-initramfs-Fix-legacy-mountpoint-rootfs.patch -- 2.30.2