summaryrefslogtreecommitdiff
path: root/Detail.c
diff options
context:
space:
mode:
authorTomasz Majchrzak <tomasz.majchrzak@intel.com>2017-05-24 11:34:22 +0200
committerJes Sorensen <jsorensen@fb.com>2017-05-24 13:28:33 -0400
commit9b8fea914f82281c440cdce9dee6a3775265861c (patch)
tree23ab6d42edc8a55c495da33fc3ba2dcc243352bb /Detail.c
parent8fac4a54cbafdd8e0a6a0c0b3ce87f1bcdef3d9d (diff)
downloadmdadm-9b8fea914f82281c440cdce9dee6a3775265861c.tar.gz
Detail: don't exit if ioctl has been successful
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>
Diffstat (limited to 'Detail.c')
-rw-r--r--Detail.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/Detail.c b/Detail.c
index bf881ff..2332b85 100644
--- 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);
- 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);
- sysfs_free(sra);
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))