]> git.proxmox.com Git - mirror_zfs.git/commitdiff
initramfs: Fix legacy mountpoint rootfs
authorRyan Moeller <ryan@iXsystems.com>
Mon, 12 Dec 2022 18:23:06 +0000 (13:23 -0500)
committerGitHub <noreply@github.com>
Mon, 12 Dec 2022 18:23:06 +0000 (10:23 -0800)
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 <ryao@gentoo.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #14274

contrib/initramfs/scripts/zfs

index 587dd5eba9ef8dc63b7ee700d58299cb9de5eec4..20fea8c34d9b708e630db56d4bd1d3856bb328a0 100644 (file)
@@ -333,25 +333,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