diff options
author | NeilBrown <neilb@suse.de> | 2008-11-04 10:54:50 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2008-11-04 10:54:50 +0100 |
commit | bde2c6e2870148c85f971d93e88c128d2bd0be10 (patch) | |
tree | c33cf455ed86c3d79b3ed3ecfd4cb1554add9d40 /mdopen.c | |
parent | Assemble: we were missing a 'close' (diff) | |
download | mdadm-bde2c6e2870148c85f971d93e88c128d2bd0be10.tar.xz mdadm-bde2c6e2870148c85f971d93e88c128d2bd0be10.zip |
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 <neilb@suse.de>
Diffstat (limited to 'mdopen.c')
-rw-r--r-- | mdopen.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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) { |