]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Call free_super earlier when creating an array.
authorNeilBrown <neilb@suse.de>
Mon, 31 Jan 2011 00:34:42 +0000 (11:34 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 31 Jan 2011 00:34:42 +0000 (11:34 +1100)
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 <neilb@suse.de>
Create.c

index 7c6979ac2047ad68e55035585aef7c3e8f937143..a0669fe0075dfdd013d99c6bc03ae11ca78a7c39 100644 (file)
--- 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));
                                                Name ": ADD_NEW_DISK for %s "
                                                "failed: %s\n",
                                                dv->devname, strerror(errno));
-                                       st->ss->free_super(st);
                                        goto abort;
                                }
                                break;
                                        goto abort;
                                }
                                break;
@@ -866,10 +865,10 @@ int Create(struct supertype *st, char *mddev,
                        map_unlock(&map);
 
                        flush_metadata_updates(st);
                        map_unlock(&map);
 
                        flush_metadata_updates(st);
+                       st->ss->free_super(st);
                }
        }
        free(infos);
                }
        }
        free(infos);
-       st->ss->free_super(st);
 
        if (level == LEVEL_CONTAINER) {
                /* No need to start.  But we should signal udev to
 
        if (level == LEVEL_CONTAINER) {
                /* No need to start.  But we should signal udev to