Fix zfs:AUTO autodetection in initramfs scripts

Don't exit early in find_rootfs() when zpool.bootfs
is set to `zfs:AUTO`.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #12658
This commit is contained in:
Damian Szuberski 2021-11-13 16:02:50 +01:00 committed by GitHub
parent ac32854a6e
commit 8ac58c3f56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,7 +79,9 @@ find_rootfs()
# If it's already specified, just keep it mounted and exit # If it's already specified, just keep it mounted and exit
# User (kernel command line) must be correct. # User (kernel command line) must be correct.
[ -n "${ZFS_BOOTFS}" ] && return 0 if [ -n "${ZFS_BOOTFS}" ] && [ "${ZFS_BOOTFS}" != "zfs:AUTO" ]; then
return 0
fi
# Not set, try to find it in the 'bootfs' property of the pool. # Not set, try to find it in the 'bootfs' property of the pool.
# NOTE: zpool does not support 'get -H -ovalue bootfs'... # NOTE: zpool does not support 'get -H -ovalue bootfs'...
@ -756,7 +758,7 @@ mountroot()
# rpool=rpool (default if none of the above is used) # rpool=rpool (default if none of the above is used)
# root=<pool>/<dataset> (uses this for rpool - first part) # root=<pool>/<dataset> (uses this for rpool - first part)
# root=ZFS=<pool>/<dataset> (uses this for rpool - first part, without 'ZFS=') # root=ZFS=<pool>/<dataset> (uses this for rpool - first part, without 'ZFS=')
# root=zfs:AUTO (tries to detect both pool and rootfs # root=zfs:AUTO (tries to detect both pool and rootfs)
# root=zfs:<pool>/<dataset> (uses this for rpool - first part, without 'zfs:') # root=zfs:<pool>/<dataset> (uses this for rpool - first part, without 'zfs:')
# #
# Option <dataset> could also be <snapshot> # Option <dataset> could also be <snapshot>