diff options
author | Neil Brown <neilb@suse.de> | 2008-05-20 16:28:48 +1000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2008-05-20 16:28:48 +1000 |
commit | 1c203a4b5a05789a0de2548294c049481bff2254 (patch) | |
tree | d435235f7fc9983584f1811014ecb4c251c6cf08 /Assemble.c | |
parent | df5a0b92954c22128e6beceb6f5df8e303848d71 (diff) | |
download | mdadm-1c203a4b5a05789a0de2548294c049481bff2254.tar.gz mdadm-1c203a4b5a05789a0de2548294c049481bff2254.tar.xz mdadm-1c203a4b5a05789a0de2548294c049481bff2254.zip |
Fix autoassemble for stack arrays.
If you have stacked arrays, then
mdadm -As --homehost=fred
should work but doesn't. It gets into an infinite loop!
So write some tests, and fix the bugs.
Diffstat (limited to 'Assemble.c')
-rw-r--r-- | Assemble.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -377,7 +377,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd, */ mdu_array_info_t inf; char *c; - if (!st->sb) { + if (!st || !st->sb) { return 2; } st->ss->getinfo_super(st, &info); @@ -975,7 +975,10 @@ int Assemble(struct supertype *st, char *mddev, int mdfd, "start the array while not clean " "- consider --force.\n"); - if (must_close) close(mdfd); + if (must_close) { + ioctl(mdfd, STOP_ARRAY, NULL); + close(mdfd); + } return 1; } if (runstop == -1) { @@ -1009,7 +1012,10 @@ int Assemble(struct supertype *st, char *mddev, int mdfd, fprintf(stderr, " (use --run to insist).\n"); } } - if (must_close) close(mdfd); + if (must_close) { + ioctl(mdfd, STOP_ARRAY, NULL); + close(mdfd); + } return 1; } else { /* The "chosen_drive" is a good choice, and if necessary, the superblock has |