Skip to content

Commit 5e0935c

Browse files
nabijaczleweliRageLtMan
authored andcommitted
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 openzfs#11278 Closes openzfs#11838
1 parent df19717 commit 5e0935c

File tree

1 file changed

+9
-4
lines changed
  • contrib/initramfs/scripts

1 file changed

+9
-4
lines changed

contrib/initramfs/scripts/zfs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ find_rootfs()
9494

9595
# Not boot fs here, export it and later try again..
9696
"${ZPOOL}" export "$pool"
97-
POOL_IMPORTED=""
98-
97+
POOL_IMPORTED=
98+
ZFS_BOOTFS=
9999
return 1
100100
}
101101

@@ -815,6 +815,11 @@ mountroot()
815815
then
816816
# Try to detect both pool and root fs.
817817

818+
# If we got here, that means we don't have a hint so as to
819+
# the root dataset, but with root=zfs:AUTO on cmdline,
820+
# this says "zfs:AUTO" here and interferes with checks later
821+
ZFS_BOOTFS=
822+
818823
[ "$quiet" != "y" ] && \
819824
zfs_log_begin_msg "Attempting to import additional pools."
820825

@@ -832,8 +837,8 @@ mountroot()
832837
do
833838
[ -z "$pool" ] && continue
834839

835-
import_pool "$pool"
836-
find_rootfs "$pool"
840+
IFS="$OLD_IFS" import_pool "$pool"
841+
IFS="$OLD_IFS" find_rootfs "$pool" && break
837842
done
838843
IFS="$OLD_IFS"
839844

0 commit comments

Comments
 (0)