]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Restore ability to create imsm array from specific devices.
authorNeilBrown <neilb@suse.de>
Mon, 23 May 2011 07:21:37 +0000 (17:21 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 23 May 2011 07:21:37 +0000 (17:21 +1000)
A recent change to improve error messages make it not possible to
create an array from devices that are 'busy'.  However if they are
made busy by a container, then the create should be allowed.

So move one of the error messages later.

Reported-by: "Wojcik, Krzysztof" <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Create.c

index f45ee21912751c838cc0ad18ca3f23dbe8531973..1aeff77b7668ba1eb7cacfcf3ffa90bccbf43ccb 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -302,7 +302,7 @@ int Create(struct supertype *st, char *mddev,
                        missing_disks ++;
                        continue;
                }
-               dfd = open(dname, O_RDONLY|O_EXCL);
+               dfd = open(dname, O_RDONLY);
                if (dfd < 0) {
                        fprintf(stderr, Name ": cannot open %s: %s\n",
                                dname, strerror(errno));
@@ -345,6 +345,12 @@ int Create(struct supertype *st, char *mddev,
                        }
 
                        if (!st) {
+                               int dfd = open(dname, O_RDONLY|O_EXCL);
+                               if (dfd < 0) {
+                                       fprintf(stderr, Name ": cannot open %s: %s\n",
+                                               dname, strerror(errno));
+                                       exit(2);
+                               }
                                fprintf(stderr, Name ": device %s not suitable "
                                        "for any style of array\n",
                                        dname);