]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Detail: don't exit if ioctl has been successful
authorTomasz Majchrzak <tomasz.majchrzak@intel.com>
Wed, 24 May 2017 09:34:22 +0000 (11:34 +0200)
committerJes Sorensen <jsorensen@fb.com>
Wed, 24 May 2017 17:28:33 +0000 (13:28 -0400)
When GET_ARRAY_INFO ioctl is successful, mdadm exits with an error.
It breaks udev and no links in /dev/md are created.

Also change debug print to error print in the message indicating lack
of the link to facilitate debugging similar issues in the future.

Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Detail.c
util.c

index bf881ff70e5dc4df308a60fa7214c154f0da681b..2332b8526c0f59c63160894888793409de0862ef 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -99,21 +99,24 @@ int Detail(char *dev, struct context *c)
        inactive = (sra->array_state == ARRAY_ACTIVE ||
                    sra->array_state == ARRAY_CLEAR);
        st = super_by_fd(fd, &subarray);
        inactive = (sra->array_state == ARRAY_ACTIVE ||
                    sra->array_state == ARRAY_CLEAR);
        st = super_by_fd(fd, &subarray);
-       if (md_get_array_info(fd, &array) && errno == ENODEV) {
-               if (sra->array.major_version == -1 &&
-                   sra->array.minor_version == -1 &&
-                   sra->devs == NULL) {
-                       pr_err("Array associated with md device %s does not exist.\n", dev);
+       if (md_get_array_info(fd, &array)) {
+               if (errno == ENODEV) {
+                       if (sra->array.major_version == -1 &&
+                           sra->array.minor_version == -1 &&
+                           sra->devs == NULL) {
+                               pr_err("Array associated with md device %s does not exist.\n",
+                                      dev);
+                               close(fd);
+                               sysfs_free(sra);
+                               return rv;
+                       }
+                       array = sra->array;
+               } else {
+                       pr_err("cannot get array detail for %s: %s\n",
+                              dev, strerror(errno));
                        close(fd);
                        close(fd);
-                       sysfs_free(sra);
                        return rv;
                }
                        return rv;
                }
-               array = sra->array;
-       } else {
-               pr_err("cannot get array detail for %s: %s\n",
-                      dev, strerror(errno));
-               close(fd);
-               return rv;
        }
 
        if (fstat(fd, &stb) != 0 && !S_ISBLK(stb.st_mode))
        }
 
        if (fstat(fd, &stb) != 0 && !S_ISBLK(stb.st_mode))
diff --git a/util.c b/util.c
index d89438c812ef809e18710e052bee584f8525def9..8eeb509af6ebf17a7b409f9c5b1aec27569a0b3c 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1169,7 +1169,7 @@ void wait_for(char *dev, int fd)
                        delay *= 2;
        }
        if (i == 25)
                        delay *= 2;
        }
        if (i == 25)
-               dprintf("timeout waiting for %s\n", dev);
+               pr_err("timeout waiting for %s\n", dev);
 }
 
 struct superswitch *superlist[] =
 }
 
 struct superswitch *superlist[] =