diff options
author | Dan Williams <dan.j.williams@intel.com> | 2010-04-19 07:28:07 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-04-19 07:28:07 +0200 |
commit | 4eb269706f403d2424166683688f0a41d893c1c3 (patch) | |
tree | eff7209c10aa9810ba7cbe4eca325357388aab5c /Manage.c | |
parent | Fixup default definitions of VAR_RUN and ALT_RUN (diff) | |
download | mdadm-4eb269706f403d2424166683688f0a41d893c1c3.tar.xz mdadm-4eb269706f403d2424166683688f0a41d893c1c3.zip |
Create: cleanup after failed create in duplicated array member case
mdadm prevents creation when device names are duplicated on the command
line, but leaves the partially created array intact. Detect this case
in the error code from add_to_super() and cleanup the partially created
array. The imsm handler is updated to report this conflict in
add_to_super_imsm_volume().
Note that since neither mdmon, nor userspace for that matter, ever saw an
active array we only need to perform a subset of the cleanup actions.
So call ioctl(STOP_ARRAY) directly and arrange for Create() to cleanup
the map file rather than calling Manage_runstop().
Reported-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'Manage.c')
-rw-r--r-- | Manage.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -298,11 +298,9 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet) if (quiet <= 0) fprintf(stderr, Name ": stopped %s\n", devname); - if (devnum != NoMdDev) { - map_delete(&map, devnum); - map_write(map); - map_free(map); - } + map_lock(&map); + map_remove(&map, devnum); + map_unlock(&map); } return 0; } |