From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH zfsonlinux v2 2/2] fix #5288: cherry-pick fix for udev-partition links > 16
Date: Wed, 6 Mar 2024 14:24:36 +0100 [thread overview]
Message-ID: <20240306132436.1214390-3-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20240306132436.1214390-1-s.ivanov@proxmox.com>
see:
https://github.com/openzfs/zfs/pull/15970
https://github.com/openzfs/zfs/issues/15904
for some additional background.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
...rectly-handle-partition-16-and-later.patch | 52 +++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 53 insertions(+)
create mode 100644 debian/patches/0012-udev-correctly-handle-partition-16-and-later.patch
diff --git a/debian/patches/0012-udev-correctly-handle-partition-16-and-later.patch b/debian/patches/0012-udev-correctly-handle-partition-16-and-later.patch
new file mode 100644
index 00000000..578b74bd
--- /dev/null
+++ b/debian/patches/0012-udev-correctly-handle-partition-16-and-later.patch
@@ -0,0 +1,52 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
+Date: Wed, 6 Mar 2024 10:39:06 +0100
+Subject: [PATCH] udev: correctly handle partition #16 and later
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+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: #15904
+
+Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
+Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
+---
+ udev/zvol_id.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/udev/zvol_id.c b/udev/zvol_id.c
+index 5960b9787..609349594 100644
+--- a/udev/zvol_id.c
++++ b/udev/zvol_id.c
+@@ -51,7 +51,7 @@ const char *__asan_default_options(void) {
+ int
+ main(int argc, const char *const *argv)
+ {
+- if (argc != 2) {
++ if (argc != 2 || strncmp(argv[1], "/dev/zd", 7) != 0) {
+ fprintf(stderr, "usage: %s /dev/zdX\n", argv[0]);
+ return (1);
+ }
+@@ -72,9 +72,10 @@ main(int argc, const char *const *argv)
+ return (1);
+ }
+
+- unsigned int dev_part = minor(sb.st_rdev) % ZVOL_MINORS;
+- if (dev_part != 0)
+- sprintf(zvol_name + strlen(zvol_name), "-part%u", dev_part);
++ const char *dev_part = strrchr(dev_name, 'p');
++ if (dev_part != NULL) {
++ sprintf(zvol_name + strlen(zvol_name), "-part%s", dev_part + 1);
++ }
+
+ for (size_t i = 0; i < strlen(zvol_name); ++i)
+ if (isblank(zvol_name[i]))
diff --git a/debian/patches/series b/debian/patches/series
index 35f81d13..9eedf857 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,3 +9,4 @@
0009-arc-stat-summary-guard-access-to-l2arc-MFU-MRU-stats.patch
0010-Fix-nfs_truncate_shares-without-etc-exports.d.patch
0011-zpool-status-tighten-bounds-for-noalloc-stat-availab.patch
+0012-udev-correctly-handle-partition-16-and-later.patch
--
2.39.2
next prev parent reply other threads:[~2024-03-06 13:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 13:24 [pve-devel] [PATCH zfsonlinux v2 0/2] update ZFS to 2.2.3 and include a fix for udev-links for partitions Stoiko Ivanov
2024-03-06 13:24 ` [pve-devel] [PATCH zfsonlinux v2 1/2] update zfs submodule to 2.2.3 and refresh patches Stoiko Ivanov
2024-03-06 13:24 ` Stoiko Ivanov [this message]
2024-03-07 7:49 ` [pve-devel] [PATCH zfsonlinux v2 2/2] fix #5288: cherry-pick fix for udev-partition links > 16 Fabian Grünbichler
2024-03-11 14:49 ` [pve-devel] applied-series: [PATCH zfsonlinux v2 0/2] update ZFS to 2.2.3 and include a fix for udev-links for partitions Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240306132436.1214390-3-s.ivanov@proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.