From: NeilBrown Date: Tue, 4 Nov 2008 09:54:50 +0000 (+1100) Subject: mdopen: only let numeric name set minor number if it doesn't cause a conflict. X-Git-Tag: mdadm-3.0-devel2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bde2c6e2870148c85f971d93e88c128d2bd0be10;p=thirdparty%2Fmdadm.git mdopen: only let numeric name set minor number if it doesn't cause a conflict. So if the array with minor number matching the name of a new array already exists, just assemble with a different minor number. Signed-off-by: NeilBrown --- diff --git a/mdopen.c b/mdopen.c index 32ccdbbe..e1c0d7f2 100644 --- a/mdopen.c +++ b/mdopen.c @@ -235,11 +235,14 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy, use_mdp = 0; } if (num < 0 && trustworthy == LOCAL && name) { - /* if name is numeric, us that for num */ + /* if name is numeric, use that for num + * if it is not already in use */ char *ep; num = strtoul(name, &ep, 10); if (ep == name || *ep) num = -1; + else if (mddev_busy(use_mdp ? (-1-num) : num)) + num = -1; } if (num < 0) {