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

udev: correctly handle partition #16 and later #15970

Merged

Conversation

Fabian-Gruenbichler
Copy link
Contributor

Motivation and Context

If a zvol has more than 15 partitions, the minor device number exhausts the slot count reserved for partitions next to the zvol itself. As a result, the minor number cannot be used to determine the partition number for the higher partition, and doing so results in wrong named symlinks being generated by udev.

Fixes: #15904

Description

Since the partition number is encoded in the block device name anyway, let's just extract it from there instead.

How Has This Been Tested?

Created a zvol with more than 15 partitions. Compared generated named symlinks with and without the fix.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

If a zvol has more than 15 partitions, the minor device number exhausts
the slot count reserved for partitions next to the zvol itself. As a
result, the minor number cannot be used to determine the partition
number for the higher partition, and doing so results in wrong named
symlinks being generated by udev.

Since the partition number is encoded in the block device name anyway,
let's just extract it from there instead.

Fixes: openzfs#15904

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
@stfl
Copy link
Contributor

stfl commented Mar 6, 2024

As a reference, Amazon ships their Amazon Linux 2023 KVM disk image with partition ids 127 and 128.
https://docs.aws.amazon.com/linux/al2023/ug/outside-ec2-download.html

@Fabian-Gruenbichler
Copy link
Contributor Author

FWIW, I am fairly sure the test failure is not this PRs fault :)

@PaulArandjelovic
Copy link

PaulArandjelovic commented Mar 20, 2024

Hi there, do we have any idea when this will be merged in? Or if it's merged in a separate PR, could we link it to this one? I'm currently having this exact problem.

@Fabian-Gruenbichler
Copy link
Contributor Author

I don't know about the timeline, but the fix is entirely in the udev helper, so if you know how to build ZFS, then it's fairly easy to build and deploy ;)

@behlendorf behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label Mar 21, 2024
@behlendorf behlendorf merged commit f1b3683 into openzfs:master Mar 21, 2024
23 of 26 checks passed
@tonyhutter
Copy link
Contributor

Hi there, do we have any idea when this will be merged in?

@PaulArandjelovic the commit will be in our upcoming 2.2.4 release: #16107

tonyhutter pushed a commit that referenced this pull request May 2, 2024
If a zvol has more than 15 partitions, the minor device number exhausts
the slot count reserved for partitions next to the zvol itself. As a
result, the minor number cannot be used to determine the partition
number for the higher partition, and doing so results in wrong named
symlinks being generated by udev.

Since the partition number is encoded in the block device name anyway,
let's just extract it from there instead.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Closes #15904
Closes #15970
datty pushed a commit to datty/zfsonlinux that referenced this pull request Jun 13, 2024
If a zvol has more than 15 partitions, the minor device number
exhausts the slot count reserved for partitions next to the zvol
itself. As a result, the minor number cannot be used to determine the
partition number for the higher partition, and doing so results in
wrong named symlinks being generated by udev.

Since the partition number is encoded in the block device name anyway,
let's just extract it from there instead.

For upstream issue and PR discussion see:
openzfs/zfs#15970
openzfs/zfs#15904

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Sep 4, 2024
If a zvol has more than 15 partitions, the minor device number exhausts
the slot count reserved for partitions next to the zvol itself. As a
result, the minor number cannot be used to determine the partition
number for the higher partition, and doing so results in wrong named
symlinks being generated by udev.

Since the partition number is encoded in the block device name anyway,
let's just extract it from there instead.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Closes openzfs#15904
Closes openzfs#15970
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The destination of symbolic links under /dev/zvol is not created correctly.
6 participants