From: Lidong Zhong <lzhong@suse.com>
To: linux-raid@vger.kernel.org
Cc: colyli@suse.com, Jes.Sorensen@gmail.com, neilb@suse.com
Subject: [Patch v1] Detail: fix a bug when trying to show the detail of a raid device
Date: Fri, 26 May 2017 10:42:16 +0800 [thread overview]
Message-ID: <20170526024216.10248-1-lzhong@suse.com> (raw)
It's introduced from commit a4dcdb23ea63.
Signed-off-by: Lidong Zhong <lzhong@suse.com>
---
Detail.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Detail.c b/Detail.c
index bf881ff..c89b927 100644
--- a/Detail.c
+++ b/Detail.c
@@ -98,8 +98,8 @@ int Detail(char *dev, struct context *c)
sra->array.minor_version == -2);
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) {
+ rv = md_get_array_info(fd, &array);
+ if (rv && errno == ENODEV) {
if (sra->array.major_version == -1 &&
sra->array.minor_version == -1 &&
sra->devs == NULL) {
@@ -109,7 +109,7 @@ int Detail(char *dev, struct context *c)
return rv;
}
array = sra->array;
- } else {
+ } else if (rv) {
pr_err("cannot get array detail for %s: %s\n",
dev, strerror(errno));
close(fd);
@@ -118,8 +118,8 @@ int Detail(char *dev, struct context *c)
if (fstat(fd, &stb) != 0 && !S_ISBLK(stb.st_mode))
stb.st_rdev = 0;
- rv = 0;
+ st = super_by_fd(fd, &subarray);
if (st)
max_disks = st->max_devs;
--
2.12.0
next reply other threads:[~2017-05-26 2:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-26 2:42 Lidong Zhong [this message]
2017-05-26 6:33 ` [Patch v1] Detail: fix a bug when trying to show the detail of a raid device Lidong Zhong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170526024216.10248-1-lzhong@suse.com \
--to=lzhong@suse.com \
--cc=Jes.Sorensen@gmail.com \
--cc=colyli@suse.com \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox