From: Dan Williams Date: Tue, 20 Jan 2009 08:36:50 +0000 (-0700) Subject: Assemble: fix busy detection X-Git-Tag: mdadm-3.0-devel3~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66afdfa977d087a9cfae3175175537affd5ac6de;p=thirdparty%2Fmdadm.git Assemble: fix busy detection Use mddev_busy() as GET_ARRAY_INFO can succeed on 'clear' arrays. Ran into this after an encountering a case where mdadm -Ss ended in segfault (missing check for NULL return from map_by_devnum() in sles11:Manage.c). So, tried to stop the array by hand with echo clear > md/array_state, after which I could not reassemble since GET_ARRAY_INFO was succeeding. Signed-off-by: Dan Williams --- diff --git a/Assemble.c b/Assemble.c index 3c55b1ec..4d12edc0 100644 --- a/Assemble.c +++ b/Assemble.c @@ -168,7 +168,6 @@ int Assemble(struct supertype *st, char *mddev, mddev_dev_t tmpdev; struct mdinfo info; struct mdinfo *content = NULL; - mdu_array_info_t tmp_inf; char *avail; int nextspare = 0; char *name = NULL; @@ -525,7 +524,7 @@ int Assemble(struct supertype *st, char *mddev, close(mdfd); return 1; } - if (ioctl(mdfd, GET_ARRAY_INFO, &tmp_inf)==0) { + if (mddev_busy(fd2devnum(mdfd))) { fprintf(stderr, Name ": %s already active, cannot restart it!\n", mddev); for (tmpdev = devlist ;