Fixed problems that could cause infinitel loop with auto assemble.
If an auto-assembly attempt failes because the array cannot be opened or because the array has already been created, then we get into an infinite loop. Reported-by: Dan Pascu <dan@ag-projects.com> Fixes-debian-bug: 396582
This commit is contained in:
parent
2790ffe38a
commit
60e1bc1a33
22
Assemble.c
22
Assemble.c
|
@ -185,6 +185,8 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
|
|||
else if (mdfd >= 0)
|
||||
inargv = 1;
|
||||
|
||||
try_again:
|
||||
|
||||
tmpdev = devlist; num_devs = 0;
|
||||
while (tmpdev) {
|
||||
if (tmpdev->used)
|
||||
|
@ -383,14 +385,28 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
|
|||
else
|
||||
asprintf(&mddev, "/dev/md/%s", c);
|
||||
mdfd = open_mddev(mddev, ident->autof);
|
||||
if (mdfd < 0)
|
||||
return mdfd;
|
||||
if (mdfd < 0) {
|
||||
free(first_super);
|
||||
free(devices);
|
||||
first_super = NULL;
|
||||
goto try_again;
|
||||
}
|
||||
vers = md_get_version(mdfd);
|
||||
if (ioctl(mdfd, GET_ARRAY_INFO, &inf)==0) {
|
||||
for (tmpdev = devlist ;
|
||||
tmpdev && tmpdev->used != 1;
|
||||
tmpdev = tmpdev->next)
|
||||
;
|
||||
fprintf(stderr, Name ": %s already active, cannot restart it!\n", mddev);
|
||||
if (tmpdev)
|
||||
fprintf(stderr, Name ": %s needed for %s...\n",
|
||||
mddev, tmpdev->devname);
|
||||
close(mdfd);
|
||||
mdfd = -1;
|
||||
free(first_super);
|
||||
return 1;
|
||||
free(devices);
|
||||
first_super = NULL;
|
||||
goto try_again;
|
||||
}
|
||||
must_close = 1;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ Changes Prior to 2.5.6 release
|
|||
- Fix bug which meant "bitmap=xxx" in mdadm.conf was not handled
|
||||
properly.
|
||||
- Documentation updates.
|
||||
- Fix bug that caused infinite loop when doing auto-assembly,
|
||||
in certain cases where arrays couldn't be assembled.
|
||||
|
||||
Changes Prior to 2.5.5 release
|
||||
- Don't #include linux/blkpg.h as that isn't safe. Just
|
||||
|
|
Loading…
Reference in New Issue