Dracut upstream made some change that break kdump, just fix it by move some dracut functions into kexec-tools.
Kairui Song (3): Change all get_maj_min call to kdump_get_maj_min kdump-lib.sh: simplify kdump_get_persistent_dev kdump-lib.sh: make kdump_get_persistent_dev no longer depend on dracut
kdump-lib.sh | 41 +++++++++++++++++++++++++++++++---------- kdumpctl | 2 +- mkdumprd | 4 ++-- 3 files changed, 34 insertions(+), 13 deletions(-)
get_maj_min is a dracut function and now it have changed to use a cache to improve performance, also make it require the caller to setup the cache manually, else it will raise an error. kexec-tools scirpt can use it's own version to avoid the cache issue.
We already have a kdump_get_maj_min which is the same with get_maj_min, just drop all get_maj_min calls and use kdump_get_maj_min. --- kdumpctl | 2 +- mkdumprd | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 978dae5..a53331a 100755 --- a/kdumpctl +++ b/kdumpctl @@ -452,7 +452,7 @@ check_drivers_modified()
ddebug "MAJ:MIN=$1 drivers='$_drivers'" } - check_block_and_slaves_all _record_block_drivers "$(get_maj_min "$_target")" + check_block_and_slaves_all _record_block_drivers "$(kdump_get_maj_min "$_target")" fi
# Include watchdog drivers if watchdog module is not omitted diff --git a/mkdumprd b/mkdumprd index b518078..c0e8435 100644 --- a/mkdumprd +++ b/mkdumprd @@ -332,7 +332,7 @@ for_each_block_target()
for dev in $(get_kdump_targets); do [ -b "$dev" ] || continue - majmin=$(get_maj_min $dev) + majmin=$(kdump_get_maj_min $dev) check_block_and_slaves $1 $majmin && return 1 done
@@ -380,7 +380,7 @@ check_crypt() local _dev
for _dev in $(get_kdump_targets); do - if [[ -n $(get_luks_crypt_dev "$(get_maj_min "$_dev")") ]]; then + if [[ -n $(get_luks_crypt_dev "$(kdump_get_maj_min "$_dev")") ]]; then derror "Device $_dev is encrypted." && return 1 fi done
Some code is duplicated with to_dev_name, just use to_dev_name.
Signed-off-by: Kairui Song kasong@redhat.com --- kdump-lib.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 74072c5..d32871a 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -318,16 +318,8 @@ get_option_value() { }
kdump_get_persistent_dev() { - local dev="${1//"/}" + local dev=$(to_dev_name $1)
- case "$dev" in - UUID=*) - dev=`blkid -U "${dev#UUID=}"` - ;; - LABEL=*) - dev=`blkid -L "${dev#LABEL=}"` - ;; - esac echo $(get_persistent_dev "$dev") }
Currentl kdump_get_persistent_dev just call dracut's get_persistent_dev, but dracut's get_persistent_dev will call dracut's get_maj_min which need caller to do extra setup work. dracut function can keep changing in the future, so make kdump-lib.sh's kdump_get_persistent_dev independent to dracut change.
The new added function code are just copied from dracut with converting get_maj_min call to kdump_get_maj_min.
Signed-off-by: Kairui Song kasong@redhat.com --- kdump-lib.sh | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index d32871a..f08fa5a 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -318,9 +318,38 @@ get_option_value() { }
kdump_get_persistent_dev() { - local dev=$(to_dev_name $1) + local _dev i _tmp _pol
- echo $(get_persistent_dev "$dev") + _dev=$(to_dev_name $1) + _dev=$(kdump_get_maj_min "$1") + + [ -z "$_dev" ] && return + + if [[ -n $persistent_policy ]]; then + _pol="/dev/disk/${persistent_policy}/*" + else + _pol= + fi + + for i in \ + $_pol \ + /dev/mapper/* \ + /dev/disk/by-uuid/* \ + /dev/disk/by-label/* \ + /dev/disk/by-partuuid/* \ + /dev/disk/by-partlabel/* \ + /dev/disk/by-id/* \ + /dev/disk/by-path/*; do + [[ -e $i ]] || continue + [[ $i == /dev/mapper/control ]] && continue + [[ $i == /dev/mapper/mpath* ]] && continue + _tmp=$(kdump_get_maj_min "$i") + if [ "$_tmp" = "$_dev" ]; then + printf -- "%s" "$i" + return + fi + done + printf -- "%s" "$1" }
is_ipv6_address()
On Thu, May 20, 2021 at 01:36:38PM +0800, Kairui Song wrote:
Dracut upstream made some change that break kdump, just fix it by move some dracut functions into kexec-tools.
I'm not sure which approach is better. But it seems if we define get_maj_min_cache_file before calling get_maj_min, it could lead to less code to fix this issue.
Kairui Song (3): Change all get_maj_min call to kdump_get_maj_min kdump-lib.sh: simplify kdump_get_persistent_dev kdump-lib.sh: make kdump_get_persistent_dev no longer depend on dracut
kdump-lib.sh | 41 +++++++++++++++++++++++++++++++---------- kdumpctl | 2 +- mkdumprd | 4 ++-- 3 files changed, 34 insertions(+), 13 deletions(-)
-- 2.31.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
On Thu, May 20, 2021 at 01:36:38PM +0800, Kairui Song wrote:
Dracut upstream made some change that break kdump, just fix it by move some dracut functions into kexec-tools.
FYI, there is now an upstream fix by Harald [1].
[1] https://github.com/dracutdevs/dracut/pull/1511
Kairui Song (3): Change all get_maj_min call to kdump_get_maj_min kdump-lib.sh: simplify kdump_get_persistent_dev kdump-lib.sh: make kdump_get_persistent_dev no longer depend on dracut
kdump-lib.sh | 41 +++++++++++++++++++++++++++++++---------- kdumpctl | 2 +- mkdumprd | 4 ++-- 3 files changed, 34 insertions(+), 13 deletions(-)
-- 2.31.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure