diff options
author | NeilBrown <neilb@suse.de> | 2010-11-30 23:55:35 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-03-10 07:20:25 +0100 |
commit | 002a3de3d4a05692e9951cc3aba9fec5fb937623 (patch) | |
tree | 94fe9c1635c90387a17befa1963d80ed6562f3c4 | |
parent | Create: report failure if array cannot be started. (diff) | |
download | mdadm-002a3de3d4a05692e9951cc3aba9fec5fb937623.tar.xz mdadm-002a3de3d4a05692e9951cc3aba9fec5fb937623.zip |
ddf: fail creation of new subarray with same name as old.
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | super-ddf.c | 13 | ||||
-rw-r--r-- | tests/10ddf-create | 3 |
2 files changed, 16 insertions, 0 deletions
diff --git a/super-ddf.c b/super-ddf.c index 141731a3..d06c8058 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -1960,6 +1960,19 @@ static int init_super_ddf_bvd(struct supertype *st, return 0; } + if (name) + for (venum = 0; venum < __be16_to_cpu(ddf->virt->max_vdes); venum++) + if (!all_ff(ddf->virt->entries[venum].guid)) { + char *n = ddf->virt->entries[venum].name; + + if (strncmp(name, n, 16) == 0) { + fprintf(stderr, Name ": This ddf already" + " has an array called %s\n", + name); + return 0; + } + } + for (venum = 0; venum < __be16_to_cpu(ddf->virt->max_vdes); venum++) if (all_ff(ddf->virt->entries[venum].guid)) break; diff --git a/tests/10ddf-create b/tests/10ddf-create index 58ca2646..25b13529 100644 --- a/tests/10ddf-create +++ b/tests/10ddf-create @@ -11,6 +11,9 @@ set -e mdadm -CR /dev/md/ddf0 -e ddf -n 5 $dev8 $dev9 $dev10 $dev11 $dev12 mdadm -CR r0 -l0 -n5 /dev/md/ddf0 -z 5000 +if mdadm -CR r0 -l1 -n2 /dev/md/ddf0 -z 5000 +then echo >&2 create with same name should fail ; exit 1 +fi mdadm -CR r1 -l1 -n2 /dev/md/ddf0 mdadm -CR r5 -l5 -n3 /dev/md/ddf0 testdev /dev/md/r0 5 5000 512 |