43 lines
1.5 KiB
Diff
43 lines
1.5 KiB
Diff
From 48319768f534e4655ef66176a95d2355a431d735 Mon Sep 17 00:00:00 2001
|
|
From: Martin Wilck <mwilck@suse.com>
|
|
Date: Wed, 30 Apr 2025 21:18:36 +0200
|
|
Subject: [PATCH 1007/1008] mdadm: allow any valid minor number in md device
|
|
name
|
|
|
|
Since 25aa732 ("mdadm: numbered names verification"), it is not possible
|
|
any more to create arrays /dev/md${N} with N >= 127. The limit has later
|
|
been increased to 1024, which is also artificial. The error message printed
|
|
by mdadm is misleading, as the problem is not POSIX compatibility here.
|
|
|
|
# mdadm -C -v /dev/md9999 --name=foo -l1 -n2 /dev/loop0 /dev/loop1
|
|
mdadm: Value "/dev/md9999" cannot be set as devname. Reason: Not POSIX compatible.
|
|
|
|
Given that mdadm creates an array with minor number ${N} if the argument is
|
|
/dev/md${N}, the natural limit for the number is the highest minor number
|
|
available, which is (1 << MINORBITS) with MINORBITS=20 on Linux.
|
|
|
|
Fixes: 25aa732 ("mdadm: numbered names verification")
|
|
Fixes: f786072 ("mdadm: Increase number limit in md device name to 1024.")
|
|
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
|
---
|
|
util.c | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/util.c b/util.c
|
|
index 9fe2d22..0f77521 100644
|
|
--- a/util.c
|
|
+++ b/util.c
|
|
@@ -972,7 +972,8 @@ static bool is_devname_numbered(const char *devname, const char *pref, const int
|
|
if (parse_num(&val, devname + pref_len) != 0)
|
|
return false;
|
|
|
|
- if (val > 1024)
|
|
+ /* Allow any number that represents a valid minor number */
|
|
+ if (val >= (1 << 20))
|
|
return false;
|
|
|
|
return true;
|
|
--
|
|
2.49.0
|
|
|