dracut/0016-fix-dracut-init.sh-add-module-to-mods_to_load-before.patch
Pavel Valena 52fb8f6eda Rebase to dracut-102, and additional fixes.
From-source-git-commit: 56bf1917de004cd3f9032a68a6cd09d5bd972b04

Additional fixes:

 - support for erofs in squash modules
 - always include the resume module
 - include systemd config files from /usr/lib/systemd
 - only return block devices from get_persistent_dev
 - allow for \ in get_maj_min file path
 - install blk modules using symbol blk_alloc_disk

Resolves: RHEL-32237,RHEL-32506,RHEL-43460,RHEL-47145,RHEL-49744,RHEL-53350
2024-08-08 04:43:00 +02:00

83 lines
2.5 KiB
Diff

From c81d6422d71b02ed9158a67c00fa0a5eec232f37 Mon Sep 17 00:00:00 2001
From: Philipp Rudo <prudo@redhat.com>
Date: Thu, 25 Jul 2024 12:47:00 +0200
Subject: [PATCH 16/24] fix(dracut-init.sh): add module to mods_to_load before
checking dependencies
When implementing erofs support for 99squash we end up with three
modules 99squash, 95squash-squashfs and 95squash-erofs. Where 99squash
contains the common code for filesystem images and
95squash-{squashfs,erofs} the special handing depending on the
filesystem used. This leads to a dependency cycle as we want to allow
users both to choose 99squash, when the exact filesystem doesn't matter,
as well as 95squash-{squashfs,erofs} when a specific filesystem is
required.
But when 99squash is added as a dependency calling
dracut_module_included fails in its depends() function. This lead to
cases where both handlers, 95squash-squashfs and 95squash-erofs, were
added to the initrd.
Reason for the failure is that a module only is marked to be loaded
after all it's dependencies have been checked as well. Thus a child
module cannot detect which parent module wants it to be included. Fix
this by marking modules to be loaded before checking its dependencies in
check_module. Do the same change in check_mount for consistency.
Signed-off-by: Philipp Rudo <prudo@redhat.com>
(cherry picked from commit 634b4a5c6fbe595eb240cd529d669d21eadd510c)
Related: RHEL-43460
---
dracut-init.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/dracut-init.sh b/dracut-init.sh
index 58e657b5..840c6167 100755
--- a/dracut-init.sh
+++ b/dracut-init.sh
@@ -915,6 +915,9 @@ check_mount() {
fi
fi
+ [[ " $mods_to_load " == *\ $_mod\ * ]] \
+ || mods_to_load+=" $_mod "
+
for _moddep in $(module_depends "$_mod" "$_moddir"); do
# handle deps as if they were manually added
[[ " $dracutmodules " == *\ $_mod\ * ]] \
@@ -933,9 +936,6 @@ check_mount() {
fi
done
- [[ " $mods_to_load " == *\ $_mod\ * ]] \
- || mods_to_load+=" $_mod "
-
return 0
}
@@ -990,6 +990,9 @@ check_module() {
fi
fi
+ [[ " $mods_to_load " == *\ $_mod\ * ]] \
+ || mods_to_load+=" $_mod "
+
for _moddep in $(module_depends "$_mod" "$_moddir"); do
# handle deps as if they were manually added
[[ " $dracutmodules " == *\ $_mod\ * ]] \
@@ -1008,9 +1011,6 @@ check_module() {
fi
done
- [[ " $mods_to_load " == *\ $_mod\ * ]] \
- || mods_to_load+=" $_mod "
-
return 0
}
--
2.42.0