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>
This commit is contained in:
parent
a99d346971
commit
fb52f2457a
4
util.c
4
util.c
|
@ -811,10 +811,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);
|
||||
|
|
Loading…
Reference in New Issue