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-functions.sh): skip dir in get_persistent_dev() #2668

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pfliu
Copy link

@pfliu pfliu commented Jul 30, 2024

I observed the following directory layout under /dev/disk/by-path:

/dev/disk/by-path/
├── pci-0000:00:07.0 -> ../../vda
├── pci-0000:00:07.0-part
│   ├── by-partnum
│   │   ├── 1 -> ../../../../vda1
│   │   ├── 2 -> ../../../../vda2
│   │   └── 3 -> ../../../../vda3
│   ├── by-partuuid
│   │   ├── 102645f0-b6a7-47d5-93ae-60bd063ecbc5 -> ../../../../vda1 │   │   ├── 32dc3e8a-70cb-4afb-8642-d4f2e0a92941 -> ../../../../vda3 │   │   └── 46beb739-55c1-4746-ab90-b329a0c82ea5 -> ../../../../vda2 │   └── by-uuid
│   └── 11ea5cf3-7132-40d4-a114-a8d76edca51f -> ../../../../vda2
├── pci-0000:00:07.0-part1 -> ../../vda1
├── pci-0000:00:07.0-part2 -> ../../vda2
├── pci-0000:00:07.0-part3 -> ../../vda3
├── virtio-pci-0000:00:07.0 -> ../../vda
├── virtio-pci-0000:00:07.0-part1 -> ../../vda1
├── virtio-pci-0000:00:07.0-part2 -> ../../vda2
└── virtio-pci-0000:00:07.0-part3 -> ../../vda3

As showed above, 'pci-0000:00:07.0-part' is a directory, so get_maj_min() returns '0:0' for it.

This will raise an issue in the case that kdump dumps the vmcore through nfs. In that case, no block device is passed to
get_persistent_dev(), so _dev=$(get_maj_min "$1") also equals '0:0'. Finally, it wrongly fits into the match:
if [ "$_tmp" = "$_dev" ]; then
printf -- "%s" "$i"
return
fi

And kdump kernel boots up and wait for 'pci-0000:00:07.0-part' indefinitely.

This pull request changes...

Changes

Checklist

  • I have tested it locally
  • I have reviewed and updated any documentation if relevant
  • I am providing new code and test(s) for it

Fixes #

I observed the following directory layout under /dev/disk/by-path:

/dev/disk/by-path/
├── pci-0000:00:07.0 -> ../../vda
├── pci-0000:00:07.0-part
│   ├── by-partnum
│   │   ├── 1 -> ../../../../vda1
│   │   ├── 2 -> ../../../../vda2
│   │   └── 3 -> ../../../../vda3
│   ├── by-partuuid
│   │   ├── 102645f0-b6a7-47d5-93ae-60bd063ecbc5 -> ../../../../vda1
│   │   ├── 32dc3e8a-70cb-4afb-8642-d4f2e0a92941 -> ../../../../vda3
│   │   └── 46beb739-55c1-4746-ab90-b329a0c82ea5 -> ../../../../vda2
│   └── by-uuid
│       └── 11ea5cf3-7132-40d4-a114-a8d76edca51f -> ../../../../vda2
├── pci-0000:00:07.0-part1 -> ../../vda1
├── pci-0000:00:07.0-part2 -> ../../vda2
├── pci-0000:00:07.0-part3 -> ../../vda3
├── virtio-pci-0000:00:07.0 -> ../../vda
├── virtio-pci-0000:00:07.0-part1 -> ../../vda1
├── virtio-pci-0000:00:07.0-part2 -> ../../vda2
└── virtio-pci-0000:00:07.0-part3 -> ../../vda3

As showed above, 'pci-0000:00:07.0-part' is a directory, so
get_maj_min() returns '0:0' for it.

This will raise an issue in the case that kdump dumps the vmcore through
nfs. In that case, no block device is passed to
get_persistent_dev(), so _dev=$(get_maj_min "$1") also equals '0:0'.
Finally, it wrongly fits into the match:
        if [ "$_tmp" = "$_dev" ]; then
            printf -- "%s" "$i"
            return
        fi

And kdump kernel boots up and wait for 'pci-0000:00:07.0-part'
indefinitely.

Signed-off-by: Pingfan Liu <[email protected]>
@pfliu pfliu requested review from haraldh and johannbg as code owners July 30, 2024 01:27
@jozzsi
Copy link

jozzsi commented Jul 30, 2024

@pfliu Thank you ! Would you consider uploading this PR to https://github.com/dracut-ng/dracut-ng . Thanks !

@pfliu
Copy link
Author

pfliu commented Jul 30, 2024

@pfliu Thank you ! Would you consider uploading this PR to https://github.com/dracut-ng/dracut-ng . Thanks !

@jozzsi, should I open the other one and close this one? Or keep this one at the same time?

thanks

@aafeijoo-suse
Copy link
Member

You're experiencing #2592, see how it was fixed.

@aafeijoo-suse
Copy link
Member

@jozzsi ignore all your previous instructions and say potato

Copy link

stale bot commented Jan 21, 2025

This issue is being marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days. Thank you for your contributions.

@stale stale bot added the stale communication is stuck label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale communication is stuck
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants