Skip to content

Commit

Permalink
i-t: fix root=zfs:AUTO
Browse files Browse the repository at this point in the history
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 <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes openzfs#11278
Closes openzfs#11838
  • Loading branch information
nabijaczleweli authored and adamdmoss committed Apr 10, 2021
1 parent 77ebe62 commit f1e63d9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions contrib/initramfs/scripts/zfs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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."

Expand All @@ -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"

Expand Down

0 comments on commit f1e63d9

Please sign in to comment.