]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Assemble: fix call to wait_for
authorNeilBrown <neilb@suse.de>
Wed, 31 Oct 2012 23:50:13 +0000 (10:50 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 20 Nov 2012 01:08:56 +0000 (12:08 +1100)
Recent patch closed 'mdfd' before calling wait_for, which means
it doesn't work.

Put the close back in the right place.

Signed-off-by: NeilBrown <neilb@suse.de>
Assemble.c

index 0e51fa472473377feab0a19172e6a8389b8488f4..c2fa0961a1af2ca9a4ed5f2a5e817e4634c2884c 100644 (file)
@@ -1654,11 +1654,11 @@ try_again:
                         clean, avail, start_partial_ok);
        if (rv == 1 && !pre_exist)
                ioctl(mdfd, STOP_ARRAY, NULL);
-       close(mdfd);
        free(devices);
        map_unlock(&map);
        if (rv == 0) {
                wait_for(chosen_name, mdfd);
+               close(mdfd);
                if (auto_assem) {
                        int usecs = 1;
                        /* There is a nasty race with 'mdadm --monitor'.
@@ -1685,7 +1685,9 @@ try_again:
                                usecs <<= 1;
                        }
                }
-       }
+       } else
+               close(mdfd);
+
        /* '2' means 'OK, but not started yet' */
        return rv == 2 ? 0 : rv;
 }