From 58b3c6976a61ed5481d3b67548b4f2fe43b86165 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 23 May 2011 17:21:37 +1000 Subject: [PATCH] Restore ability to create imsm array from specific devices. 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" Signed-off-by: NeilBrown --- Create.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Create.c b/Create.c index f45ee21..1aeff77 100644 --- 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);