forked from pool/mdadm
33 lines
1009 B
Plaintext
33 lines
1009 B
Plaintext
|
From fb52f2457a4df4f7061be7a0524763193a6355a7 Mon Sep 17 00:00:00 2001
|
||
|
From: NeilBrown <neilb@suse.de>
|
||
|
Date: Mon, 20 Aug 2012 10:50:42 +1000
|
||
|
Subject: [PATCH] find_free_devnum: avoid auto-using names in /etc/mdadm.conf
|
||
|
|
||
|
high-number names like "/dev/md126" shouldn't be in /etc/mdadm.conf,
|
||
|
but if they are they should be ignored when choosing an
|
||
|
unused number.
|
||
|
|
||
|
Signed-off-by: NeilBrown <neilb@suse.de>
|
||
|
|
||
|
---
|
||
|
util.c | 4 ++++
|
||
|
1 file changed, 4 insertions(+)
|
||
|
|
||
|
--- mdadm-3.2.5.orig/util.c
|
||
|
+++ mdadm-3.2.5/util.c
|
||
|
@@ -796,10 +796,14 @@ int find_free_devnum(int use_partitions)
|
||
|
devnum = devnum ? devnum-1 : (1<<20)-1) {
|
||
|
char *dn;
|
||
|
int _devnum;
|
||
|
+ char nbuf[50];
|
||
|
|
||
|
_devnum = use_partitions ? (-1-devnum) : devnum;
|
||
|
if (mddev_busy(_devnum))
|
||
|
continue;
|
||
|
+ sprintf(nbuf, "%s%d", use_partitions?"mdp":"md", devnum);
|
||
|
+ if (!conf_name_is_free(nbuf))
|
||
|
+ continue;
|
||
|
/* make sure it is new to /dev too, at least as a
|
||
|
* non-standard */
|
||
|
dn = map_dev(dev2major(_devnum), dev2minor(_devnum), 0);
|