* [PATCH] Detail: don't exit if ioctl has been successful
@ 2017-05-24 9:34 Tomasz Majchrzak
2017-05-24 17:28 ` Jes Sorensen
0 siblings, 1 reply; 2+ messages in thread
From: Tomasz Majchrzak @ 2017-05-24 9:34 UTC (permalink / raw)
To: linux-raid; +Cc: jes.sorensen, Tomasz Majchrzak
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>
---
Detail.c | 27 +++++++++++++++------------
util.c | 2 +-
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/Detail.c b/Detail.c
index ef2370c..0adccb7 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))
diff --git a/util.c b/util.c
index 11ff2cc..2e148ef 100644
--- a/util.c
+++ b/util.c
@@ -1173,7 +1173,7 @@ void wait_for(char *dev, int fd)
delay *= 2;
}
if (i == 25)
- dprintf("timeout waiting for %s\n", dev);
+ pr_err("timeout waiting for %s\n", dev);
}
struct superswitch *superlist[] =
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] Detail: don't exit if ioctl has been successful
2017-05-24 9:34 [PATCH] Detail: don't exit if ioctl has been successful Tomasz Majchrzak
@ 2017-05-24 17:28 ` Jes Sorensen
0 siblings, 0 replies; 2+ messages in thread
From: Jes Sorensen @ 2017-05-24 17:28 UTC (permalink / raw)
To: Tomasz Majchrzak, linux-raid
On 05/24/2017 05:34 AM, Tomasz Majchrzak wrote:
> 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>
> ---
> Detail.c | 27 +++++++++++++++------------
> util.c | 2 +-
> 2 files changed, 16 insertions(+), 13 deletions(-)
Applied!
Thanks,
Jes
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-24 17:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-24 9:34 [PATCH] Detail: don't exit if ioctl has been successful Tomasz Majchrzak
2017-05-24 17:28 ` Jes Sorensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox