From: NeilBrown Date: Mon, 31 Jan 2011 00:34:42 +0000 (+1100) Subject: Call free_super earlier when creating an array. X-Git-Tag: mdadm-3.2~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6946681db03c076897616bd9aae27b127456d8f5;p=thirdparty%2Fmdadm.git Call free_super earlier when creating an array. As free_super now closes fds for member devices, rather than write_init_super doing it, we need to call free_super earlier, so that the device (on which we hold an O_EXCL open) is closed before it is added to the array. So close at the end of pass-1 rather than after pass-2. Signed-off-by: NeilBrown --- diff --git a/Create.c b/Create.c index 7c6979ac..a0669fe0 100644 --- a/Create.c +++ b/Create.c @@ -823,7 +823,6 @@ int Create(struct supertype *st, char *mddev, Name ": ADD_NEW_DISK for %s " "failed: %s\n", dv->devname, strerror(errno)); - st->ss->free_super(st); goto abort; } break; @@ -866,10 +865,10 @@ int Create(struct supertype *st, char *mddev, map_unlock(&map); flush_metadata_updates(st); + st->ss->free_super(st); } } free(infos); - st->ss->free_super(st); if (level == LEVEL_CONTAINER) { /* No need to start. But we should signal udev to