Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
To: linux-raid@vger.kernel.org
Cc: jes.sorensen@gmail.com, Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Subject: [PATCH] Detail: don't exit if ioctl has been successful
Date: Wed, 24 May 2017 11:34:22 +0200	[thread overview]
Message-ID: <1495618462-23016-1-git-send-email-tomasz.majchrzak@intel.com> (raw)

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


             reply	other threads:[~2017-05-24  9:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24  9:34 Tomasz Majchrzak [this message]
2017-05-24 17:28 ` [PATCH] Detail: don't exit if ioctl has been successful Jes Sorensen

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=1495618462-23016-1-git-send-email-tomasz.majchrzak@intel.com \
    --to=tomasz.majchrzak@intel.com \
    --cc=jes.sorensen@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    /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