mdadm/find-free-devnum.fix
Neil Brown c56de49a0b - mdmon-takeover.fix
find-free-devnum.fix
  mapfile-rebuild.fix
  udev-offroot
   Fix various issues will installation on IMSM
  RAID arrays, booting from those arrays, and
  clean shutdown when such an array is used for '/'.
  (bnc#752107 bnc#732294 bnc#770351)

OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=69
2012-08-20 06:57:35 +00:00

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);