Bug#396582: Some additional info
Neil Brown
neilb at suse.de
Mon Nov 6 02:52:59 CET 2006
On Thursday November 2, madduck at debian.org wrote:
>
> Neil, can we apply the patch contributed to fix this:
>
> http://bugs.debian.org/cgi-bin/bugreport.cgi/mdadm-fix-infinite-loop.diff?bug=396582;msg=5;att=1
>
> or do I remember that you previously replaced devlist with NULL to
> fix another bug?
Replacing the NULL with devlist will stopped stacked-device from being
auto-assembled properly.
This patch seems to fix the problem, and I am happy with it.
Thanks for the report.
NeilBrown
------------------------
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 at ag-projects.com>
Fixes-debian-bug: 396582
### Diffstat output
./Assemble.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff .prev/Assemble.c ./Assemble.c
--- .prev/Assemble.c 2006-10-13 08:46:15.000000000 +1000
+++ ./Assemble.c 2006-11-06 12:48:20.000000000 +1100
@@ -185,6 +185,8 @@ int Assemble(struct supertype *st, char
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
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;
}
More information about the pkg-mdadm-devel
mailing list