]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
installer: Wait until RAID device is usable.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 24 Jul 2014 12:21:01 +0000 (14:21 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 24 Jul 2014 12:21:01 +0000 (14:21 +0200)
src/install+setup/install/hw.c

index e7d60acd32f032fff31f5ef58928b8c0fbe0383d..c86e006fb24324aa7876dafb41fa93078bec5e08 100644 (file)
@@ -711,8 +711,14 @@ int hw_setup_raid(struct hw_destination* dest) {
                while (counter-- > 0) {
                        sleep(1);
 
-                       if (access(dest->path, R_OK) == 0)
+                       // If the raid device has not yet been properly brought up,
+                       // opening it will fail with the message: Device or resource busy
+                       // Hence we will wait a bit until it becomes usable.
+                       FILE* f = fopen(dest->path, "r");
+                       if (f) {
+                               fclose(f);
                                break;
+                       }
                }
        }