forked from pool/s390-tools
58 lines
1.8 KiB
Diff
58 lines
1.8 KiB
Diff
|
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
|
||
|
@@ -826,7 +826,7 @@ fdasd_check_conffile_input (fdasd_anchor_t *anc,
|
||
|
* Verifies the specified block device.
|
||
|
*/
|
||
|
static void
|
||
|
-fdasd_verify_device (fdasd_anchor_t *anc, char *name)
|
||
|
+fdasd_verify_device (fdasd_anchor_t *anc, char *name)
|
||
|
{
|
||
|
struct stat dst;
|
||
|
char err_str[ERROR_STRING_SIZE];
|
||
|
@@ -847,7 +847,7 @@ fdasd_verify_device (fdasd_anchor_t *anc, char *name)
|
||
|
fdasd_error(anc, device_verification_failed, err_str);
|
||
|
}
|
||
|
|
||
|
- if (minor (dst.st_rdev) & PARTN_MASK) {
|
||
|
+ if (!anc->force_virtual && minor (dst.st_rdev) & PARTN_MASK) {
|
||
|
snprintf(err_str, ERROR_STRING_SIZE,
|
||
|
"Partition '%s' (%d/%d) detected where device is "
|
||
|
"required\n", name,
|
||
|
@@ -1156,9 +1156,12 @@ fdasd_reread_partition_table (fdasd_anchor_t *anc)
|
||
|
}
|
||
|
|
||
|
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);
|
||
|
}
|
||
|
--
|
||
|
1.8.5.2
|