Blame SOURCES/Detail-don-t-exit-if-ioctl-has-been-successful.patch

2c1b57
From 9b8fea914f82281c440cdce9dee6a3775265861c Mon Sep 17 00:00:00 2001
2c1b57
From: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
2c1b57
Date: Wed, 24 May 2017 11:34:22 +0200
2c1b57
Subject: [RHEL7.5 PATCH 147/169] Detail: don't exit if ioctl has been
2c1b57
 successful
2c1b57
2c1b57
When GET_ARRAY_INFO ioctl is successful, mdadm exits with an error.
2c1b57
It breaks udev and no links in /dev/md are created.
2c1b57
2c1b57
Also change debug print to error print in the message indicating lack
2c1b57
of the link to facilitate debugging similar issues in the future.
2c1b57
2c1b57
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
2c1b57
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2c1b57
---
2c1b57
 Detail.c | 27 +++++++++++++++------------
2c1b57
 util.c   |  2 +-
2c1b57
 2 files changed, 16 insertions(+), 13 deletions(-)
2c1b57
2c1b57
diff --git a/Detail.c b/Detail.c
2c1b57
index bf881ff..2332b85 100644
2c1b57
--- a/Detail.c
2c1b57
+++ b/Detail.c
2c1b57
@@ -99,21 +99,24 @@ int Detail(char *dev, struct context *c)
2c1b57
 	inactive = (sra->array_state == ARRAY_ACTIVE ||
2c1b57
 		    sra->array_state == ARRAY_CLEAR);
2c1b57
 	st = super_by_fd(fd, &subarray);
2c1b57
-	if (md_get_array_info(fd, &array) && errno == ENODEV) {
2c1b57
-		if (sra->array.major_version == -1 &&
2c1b57
-		    sra->array.minor_version == -1 &&
2c1b57
-		    sra->devs == NULL) {
2c1b57
-			pr_err("Array associated with md device %s does not exist.\n", dev);
2c1b57
+	if (md_get_array_info(fd, &array)) {
2c1b57
+		if (errno == ENODEV) {
2c1b57
+			if (sra->array.major_version == -1 &&
2c1b57
+			    sra->array.minor_version == -1 &&
2c1b57
+			    sra->devs == NULL) {
2c1b57
+				pr_err("Array associated with md device %s does not exist.\n",
2c1b57
+				       dev);
2c1b57
+				close(fd);
2c1b57
+				sysfs_free(sra);
2c1b57
+				return rv;
2c1b57
+			}
2c1b57
+			array = sra->array;
2c1b57
+		} else {
2c1b57
+			pr_err("cannot get array detail for %s: %s\n",
2c1b57
+			       dev, strerror(errno));
2c1b57
 			close(fd);
2c1b57
-			sysfs_free(sra);
2c1b57
 			return rv;
2c1b57
 		}
2c1b57
-		array = sra->array;
2c1b57
-	} else {
2c1b57
-		pr_err("cannot get array detail for %s: %s\n",
2c1b57
-		       dev, strerror(errno));
2c1b57
-		close(fd);
2c1b57
-		return rv;
2c1b57
 	}
2c1b57
 
2c1b57
 	if (fstat(fd, &stb) != 0 && !S_ISBLK(stb.st_mode))
2c1b57
diff --git a/util.c b/util.c
2c1b57
index d89438c..8eeb509 100644
2c1b57
--- a/util.c
2c1b57
+++ b/util.c
2c1b57
@@ -1169,7 +1169,7 @@ void wait_for(char *dev, int fd)
2c1b57
 			delay *= 2;
2c1b57
 	}
2c1b57
 	if (i == 25)
2c1b57
-		dprintf("timeout waiting for %s\n", dev);
2c1b57
+		pr_err("timeout waiting for %s\n", dev);
2c1b57
 }
2c1b57
 
2c1b57
 struct superswitch *superlist[] =
2c1b57
-- 
2c1b57
2.7.4
2c1b57