Don't run kdump_check_setup_iscsi in a subshell in order to collect needed network interfaces

Resolves: bz2076416
Upstream: Fedora
Conflict: None

commit 523cda8f34
Author: Coiby Xu <coxu@redhat.com>
Date:   Fri Nov 25 12:07:25 2022 +0800

    Don't run kdump_check_setup_iscsi in a subshell in order to collect needed
    network interfaces

    Currently, dumping to iSCSI target fails because the global array
    (unique_netifs) that stores the network interfaces needed by kdump is
    empty. The root cause is change of the array made in a subshell (a child
    process) is inaccessible to the parent process. So don't run
    kdump_check_setup_iscsi in a subshell.

    Fixes: 63c3805c ("Set up kdump network by directly copying NM connection profile to initrd")
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Reviewed-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Coiby Xu 2022-11-25 13:57:32 +08:00
parent 0459f68dcc
commit fa2f8fc244

View File

@ -809,7 +809,7 @@ kdump_check_iscsi_targets() {
# If our prerequisites are not met, fail anyways. # If our prerequisites are not met, fail anyways.
type -P iscsistart > /dev/null || return 1 type -P iscsistart > /dev/null || return 1
kdump_check_setup_iscsi() ( kdump_check_setup_iscsi() {
local _dev local _dev
_dev=$1 _dev=$1
@ -819,7 +819,7 @@ kdump_check_iscsi_targets() {
cd .. cd ..
done done
[[ -d iscsi_session ]] && kdump_setup_iscsi_device "$PWD" [[ -d iscsi_session ]] && kdump_setup_iscsi_device "$PWD"
) }
[[ $hostonly ]] || [[ $mount_needs ]] && { [[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_and_slaves_all kdump_check_setup_iscsi for_each_host_dev_and_slaves_all kdump_check_setup_iscsi