diff options
author | наб <[email protected]> | 2021-04-03 18:18:39 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2021-04-07 13:28:52 -0700 |
commit | 46aec6d439487fe6bdeb755eeee701847b5209ce (patch) | |
tree | af266ecd74b8ee6b5b243377c08c50de459cf57e /contrib | |
parent | 1bb4b5a5aee39136dead9ec3e502810ea6f15100 (diff) |
i-t: fix root=zfs:AUTO
IFS= would break loops in import_pool(), which would fault
any automatic import
Additionally $ZFS_BOOTFS from cmdline would interfere with find_rootfs()
If many pools were present, same thing could happen across multiple
find_rootfs() runs, so bail out early and clean up in error path
Suggested-by: @nachtgeist
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #11278
Closes #11838
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/initramfs/scripts/zfs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/contrib/initramfs/scripts/zfs b/contrib/initramfs/scripts/zfs index 130aad5de..61090a912 100644 --- a/contrib/initramfs/scripts/zfs +++ b/contrib/initramfs/scripts/zfs @@ -94,8 +94,8 @@ find_rootfs() # Not boot fs here, export it and later try again.. "${ZPOOL}" export "$pool" - POOL_IMPORTED="" - + POOL_IMPORTED= + ZFS_BOOTFS= return 1 } @@ -815,6 +815,11 @@ mountroot() then # Try to detect both pool and root fs. + # If we got here, that means we don't have a hint so as to + # the root dataset, but with root=zfs:AUTO on cmdline, + # this says "zfs:AUTO" here and interferes with checks later + ZFS_BOOTFS= + [ "$quiet" != "y" ] && \ zfs_log_begin_msg "Attempting to import additional pools." @@ -832,8 +837,8 @@ mountroot() do [ -z "$pool" ] && continue - import_pool "$pool" - find_rootfs "$pool" + IFS="$OLD_IFS" import_pool "$pool" + IFS="$OLD_IFS" find_rootfs "$pool" && break done IFS="$OLD_IFS" |