diff options
author | NeilBrown <neilb@suse.de> | 2008-11-07 22:15:14 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2008-11-07 22:15:14 +1100 |
commit | 4408ee768bab1282b23d97c3d3e073292f79e982 (patch) | |
tree | 168b28c588e4e300381bb12dcbf9455d8e4586f1 /Assemble.c | |
parent | 7cb2aa33e51bbc2952bb90590fbc47c16a7c27b3 (diff) | |
download | mdadm-4408ee768bab1282b23d97c3d3e073292f79e982.tar.gz mdadm-4408ee768bab1282b23d97c3d3e073292f79e982.tar.xz mdadm-4408ee768bab1282b23d97c3d3e073292f79e982.zip |
Assemble: close mdfd before returning from assemble_container_content
This makes sure it is consistently closed.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Assemble.c')
-rw-r--r-- | Assemble.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -1205,8 +1205,10 @@ int assemble_container_content(struct supertype *st, int mdfd, sra = sysfs_read(mdfd, 0, GET_VERSION); if (sra == NULL || strcmp(sra->text_version, content->text_version) != 0) - if (sysfs_set_array(content, md_get_version(mdfd)) != 0) + if (sysfs_set_array(content, md_get_version(mdfd)) != 0) { + close(mdfd); return 1; + } if (sra) sysfs_free(sra); @@ -1215,9 +1217,10 @@ int assemble_container_content(struct supertype *st, int mdfd, working++; else if (errno == EEXIST) preexist++; - if (working == 0) + if (working == 0) { + close(mdfd); return 1;/* Nothing new, don't try to start */ - else if (runstop > 0 || + } else if (runstop > 0 || (working + preexist) >= content->array.working_disks) { map_update(&map, fd2devnum(mdfd), @@ -1249,6 +1252,7 @@ int assemble_container_content(struct supertype *st, int mdfd, fprintf(stderr, "\n"); } wait_for(chosen_name); + close(mdfd); return 0; /* FIXME should have an O_EXCL and wait for read-auto */ } else { @@ -1257,6 +1261,7 @@ int assemble_container_content(struct supertype *st, int mdfd, ": %s assembled with %d devices but " "not started\n", chosen_name, working); + close(mdfd); return 1; } } |