File s390-tools-sles12-fdasd-skip-partition-check-and-BLKRRPART-ioctl.patch of Package s390-tools.10760

From d0c2ffc90b9ee0e7b741d1c4b644cdf79f1d922b Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 20 May 2015 11:57:11 +0200
Subject: [PATCH] fdasd: skip partition check and BLKRRPART ioctl for emulated
 devices

If 'fdasd -f' is called we cannot rely on the partition detection
via a simple check of the minor number, so the check should be
suppressed.
Similarly, not every emulated device supports the BLKRRPART ioctl,
so we should be suppressing the error message for these devices, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 fdasd/fdasd.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/fdasd/fdasd.c b/fdasd/fdasd.c
index 4503d3e..f04dc3d 100644
--- a/fdasd/fdasd.c
+++ b/fdasd/fdasd.c
@@ -1247,9 +1247,12 @@
 	}
 
 	if (ioctl(fd, BLKRRPART, NULL) != 0) {
-		close(fd);
-		fdasd_error(anc, unable_to_ioctl, "Error while rereading "
-			    "partition table.\nPlease reboot!");
+		if (errno == EINVAL && !anc->force_virtual) {
+			close(fd);
+			fdasd_error(anc, unable_to_ioctl,
+				    "Error while rereading "
+				    "partition table.\nPlease reboot!");
+		}
 	}
 	close(fd);
 }