Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dracut): rework timeout for devices added via --mount and --add-device (bsc#1231792) #386

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dracut-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,9 @@ for_each_host_dev_and_slaves_all() {
local _dev
local _ret=1

[[ "${host_devs[*]}" ]] || return 2
[[ "${host_devs[*]}" ]] || [[ "${user_devs[*]}" ]] || return 2

for _dev in "${host_devs[@]}"; do
for _dev in "${host_devs[@]}" "${user_devs[@]}"; do
[[ -b $_dev ]] || continue
if check_block_and_slaves_all "$_func" "$(get_maj_min "$_dev")"; then
_ret=0
Expand All @@ -623,9 +623,9 @@ for_each_host_dev_and_slaves() {
local _func="$1"
local _dev

[[ "${host_devs[*]}" ]] || return 2
[[ "${host_devs[*]}" ]] || [[ "${user_devs[*]}" ]] || return 2

for _dev in "${host_devs[@]}"; do
for _dev in "${host_devs[@]}" "${user_devs[@]}"; do
[[ -b $_dev ]] || continue
check_block_and_slaves "$_func" "$(get_maj_min "$_dev")" && return 0
done
Expand Down
20 changes: 15 additions & 5 deletions dracut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,16 @@ push_host_devs() {
done
}

# Fills up user_devs stack variable and makes sure there are no duplicates
push_user_devs() {
local _dev
for _dev in "$@"; do
[[ -z $_dev ]] && continue
[[ " ${user_devs[*]} " == *" $_dev "* ]] && return
user_devs+=("$_dev")
done
}

# Little helper function for reading args from the commandline.
# it automatically handles -a b and -a=b variants, and returns 1 if
# we need to shift $3.
Expand Down Expand Up @@ -1624,7 +1634,7 @@ for line in "${fstab_lines[@]}"; do
push_host_devs "$mp"
done
fi
push_host_devs "$dev"
push_user_devs "$dev"
host_fs_types["$dev"]="$3"
done

Expand All @@ -1636,12 +1646,12 @@ for f in $add_fstab; do
done

for dev in $add_device; do
push_host_devs "$dev"
push_user_devs "$dev"
done

if ((${#add_device_l[@]})); then
add_device+=" ${add_device_l[*]} "
push_host_devs "${add_device_l[@]}"
push_user_devs "${add_device_l[@]}"
fi

if [[ $hostonly ]] && [[ $hostonly_default_device != "no" ]]; then
Expand Down Expand Up @@ -1763,7 +1773,7 @@ _get_fs_type() {
return 1
}

for dev in "${host_devs[@]}"; do
for dev in "${host_devs[@]}" "${user_devs[@]}"; do
_get_fs_type "$dev"
check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
done
Expand Down Expand Up @@ -1791,7 +1801,7 @@ export initdir dracutbasedir \
omit_drivers mdadmconf lvmconf root_devs \
use_fstab fstab_lines libdirs fscks nofscks ro_mnt \
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
host_fs_types host_devs swap_devs sshkey add_fstab \
host_fs_types host_devs user_devs swap_devs sshkey add_fstab \
DRACUT_VERSION \
prefix filesystems drivers \
hostonly_cmdline loginstall check_supported
Expand Down
18 changes: 17 additions & 1 deletion modules.d/99base/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ install() {

## save host_devs which we need bring up
if [[ $hostonly_cmdline == "yes" ]]; then
if [[ -n ${host_devs[*]} ]]; then
if [[ -n ${host_devs[*]} ]] || [[ -n ${user_devs[*]} ]]; then
dracut_need_initqueue
fi
if [[ -f $initdir/lib/dracut/need-initqueue ]] || ! dracut_module_included "systemd"; then
Expand Down Expand Up @@ -143,6 +143,22 @@ install() {
*) ;;
esac
done

for _dev in "${user_devs[@]}"; do

case "$_dev" in
/dev/?*) wait_for_dev "$_dev" 0 ;;
*) ;;
esac

_pdev=$(get_persistent_dev "$_dev")
[[ $_dev == "$_pdev" ]] && continue

case "$_pdev" in
/dev/?*) wait_for_dev "$_pdev" 0 ;;
*) ;;
esac
done
)
fi
fi
Expand Down
1 change: 1 addition & 0 deletions suse/README.susemaint
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,4 @@ a1c51af1 fix(dracut): don't apply aggressive strip to kernel modules
ad36b61e fix(dracut.sh): omit compressed kernel modules from find searching exec files
bfa00c2a fix(pcsc): add libpcsclite_real.so.*
0df92885 fix(systemd-tmpfiles): copy 20-systemd-stub.conf into the initrd
c79fc8fd fix(dracut): rework timeout for devices added via --mount and --add-device
Loading