X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=Assemble.c;h=014d644b42667a5755b2edb5736c15d9775f360b;hb=2904b26f059c5d82d9d631c9987e92e3f9af498c;hp=7da090506a224d0f6efdf4288ee8537c2ac10cb1;hpb=6e46bf344bf34a688696e240596f8259e328eea9;p=thirdparty%2Fmdadm.git diff --git a/Assemble.c b/Assemble.c index 7da09050..014d644b 100644 --- a/Assemble.c +++ b/Assemble.c @@ -315,6 +315,9 @@ int Assemble(struct supertype *st, char *mddev, } /* It is worth looking inside this container. */ + if (verbose > 0) + fprintf(stderr, Name ": looking in container %s\n", + devname); next_member: if (tmpdev->content) content = tmpdev->content; @@ -405,6 +408,9 @@ int Assemble(struct supertype *st, char *mddev, fprintf(stderr, Name ": member %s in %s is already assembled\n", content->text_version, devname); + skip: + if (tmpdev->content) + goto next_member; tst->ss->free_super(tst); tst = NULL; content = NULL; @@ -412,6 +418,21 @@ int Assemble(struct supertype *st, char *mddev, goto loop; return 1; } + if (ident->member && ident->member[0]) { + char *s = strchr(content->text_version+1, '/'); + if (s == NULL) { + fprintf(stderr, Name ": badly formatted version: %s\n", + content->text_version); + goto skip; + } + if (strcmp(ident->member, s+1) != 0) { + if (report_missmatch) + fprintf(stderr, + Name ": skipping wrong member %s\n", + content->text_version); + goto skip; + } + } st = tst; tst = NULL; if (!auto_assem && tmpdev->next != NULL) { fprintf(stderr, Name ": %s is a container, but is not " @@ -420,6 +441,9 @@ int Assemble(struct supertype *st, char *mddev, st->ss->free_super(st); return 1; } + if (verbose > 0) + fprintf(stderr, Name ": found match on member %s in %s\n", + content->text_version, devname); break; } if (st == NULL) @@ -659,7 +683,7 @@ int Assemble(struct supertype *st, char *mddev, > devices[most_recent].i.events) most_recent = devcnt; } - if (content->array.level == -4) + if (content->array.level == LEVEL_MULTIPATH) /* with multipath, the raid_disk from the superblock is meaningless */ i = devcnt; else @@ -752,8 +776,8 @@ int Assemble(struct supertype *st, char *mddev, /* note: we ignore error flags in multipath arrays * as they don't make sense */ - if (content->array.level != -4) - if (!(devices[j].i.disk.state & (1<array.level != LEVEL_MULTIPATH) + if (!(devices[j].i.disk.state & (1<reshape_active) { int err = 0; int *fdlist = malloc(sizeof(int)* bestcnt); + if (verbose > 0) + fprintf(stderr, Name ":%s has an active reshape - checking " + "if critical section needs to be restored\n", + chosen_name); for (i=0; i= 0) { @@ -980,13 +1008,15 @@ int Assemble(struct supertype *st, char *mddev, fdlist[i] = -1; } if (!err) - err = Grow_restart(st, content, fdlist, bestcnt, backup_file); + err = Grow_restart(st, content, fdlist, bestcnt, backup_file, verbose > 0); while (i>0) { i--; if (fdlist[i]>=0) close(fdlist[i]); } if (err) { fprintf(stderr, Name ": Failed to restore critical section for reshape, sorry.\n"); + if (backup_file == NULL) + fprintf(stderr," Possibly you needed to specify the --backup-file\n"); close(mdfd); return err; } @@ -1095,7 +1125,20 @@ int Assemble(struct supertype *st, char *mddev, content->array.layout, clean, avail, okcnt) && (okcnt >= req_cnt || start_partial_ok) ))) { - if (ioctl(mdfd, RUN_ARRAY, NULL)==0) { + /* This array is good-to-go. + * If a reshape is in progress then we might need to + * continue monitoring it. In that case we start + * it read-only and let the grow code make it writable. + */ + int rv; +#ifndef MDASSEMBLE + if (content->reshape_active && + content->delta_disks <= 0) + rv = Grow_continue(mdfd, st, content, backup_file); + else +#endif + rv = ioctl(mdfd, RUN_ARRAY, NULL); + if (rv == 0) { if (verbose >= 0) { fprintf(stderr, Name ": %s has been started with %d drive%s", mddev, okcnt, okcnt==1?"":"s");