]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix: let check_vol_slaves_all return 1 when checks on all slaves fail
authorCoiby Xu <coxu@redhat.com>
Mon, 26 May 2025 07:34:30 +0000 (15:34 +0800)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Mon, 26 May 2025 14:31:26 +0000 (10:31 -0400)
Currently check_vol_slaves_all return 0 even after checks on all slaves
fail. And this leads to an issue that "dracut -hostonly-mode strict"
gets stuck forever because instmods keeps waiting for user input when
it's passed empty argument in the kernel-modules module.

Fixes: c7c8c498 ("dracut-functions.sh: catch all lvm slaves")
Reported-by: Tomáš Bžatek <tbzatek@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
dracut-functions.sh

index e6b8e95849aebbcd24d33447ccf9ba95d7fccf2f..d7d7124529cd4b507386194cffbf6b191e38eed4 100755 (executable)
@@ -691,7 +691,7 @@ check_vol_slaves() {
 }
 
 check_vol_slaves_all() {
-    local _vg _pv _majmin _dm
+    local _vg _pv _majmin _dm _ret=1
     _majmin="$2"
     _dm=$(get_lvm_dm_dev "$_majmin")
     [[ -z $_dm ]] && return 1 # not an LVM device-mapper device
@@ -705,11 +705,10 @@ check_vol_slaves_all() {
         fi
 
         for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2> /dev/null); do
-            check_block_and_slaves_all "$1" "$(get_maj_min "$_pv")"
+            check_block_and_slaves_all "$1" "$(get_maj_min "$_pv")" && _ret=0
         done
-        return 0
     fi
-    return 1
+    return $_ret
 }
 
 # fs_get_option <filesystem options> <search for option>