|
|
d76c62 |
From fa46b5b4d5bb732462d0d5484cc010aa652d821b Mon Sep 17 00:00:00 2001
|
|
|
d76c62 |
Message-Id: <fa46b5b4d5bb732462d0d5484cc010aa652d821b@dist-git>
|
|
|
d76c62 |
From: John Ferlan <jferlan@redhat.com>
|
|
|
d76c62 |
Date: Mon, 17 Dec 2018 20:42:32 -0500
|
|
|
d76c62 |
Subject: [PATCH] RHEL: qemu: Alter @val usage in qemuSetUnprivSGIO
|
|
|
d76c62 |
MIME-Version: 1.0
|
|
|
d76c62 |
Content-Type: text/plain; charset=UTF-8
|
|
|
d76c62 |
Content-Transfer-Encoding: 8bit
|
|
|
d76c62 |
|
|
|
d76c62 |
https://bugzilla.redhat.com/show_bug.cgi?id=1656362 (RHEL8)
|
|
|
d76c62 |
https://bugzilla.redhat.com/show_bug.cgi?id=1656360 (RHEL7)
|
|
|
d76c62 |
|
|
|
d76c62 |
RHEL-only
|
|
|
d76c62 |
|
|
|
d76c62 |
Rather than initializing to -1 and then setting to the result
|
|
|
d76c62 |
of a boolean check (either 0 or 1), let's just initialize @val
|
|
|
d76c62 |
to 0 and then only change to 1 if conditions are "right".
|
|
|
d76c62 |
|
|
|
d76c62 |
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
|
|
d76c62 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
d76c62 |
---
|
|
|
d76c62 |
src/qemu/qemu_conf.c | 15 +++++++++------
|
|
|
d76c62 |
1 file changed, 9 insertions(+), 6 deletions(-)
|
|
|
d76c62 |
|
|
|
d76c62 |
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
|
|
d76c62 |
index 2a84972fd9..faabc4d49f 100644
|
|
|
d76c62 |
--- a/src/qemu/qemu_conf.c
|
|
|
d76c62 |
+++ b/src/qemu/qemu_conf.c
|
|
|
d76c62 |
@@ -1828,7 +1828,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
|
|
|
d76c62 |
g_autofree char *sysfs_path = NULL;
|
|
|
d76c62 |
g_autofree char *hostdev_path = NULL;
|
|
|
d76c62 |
const char *path = NULL;
|
|
|
d76c62 |
- int val = -1;
|
|
|
d76c62 |
+ int val = 0;
|
|
|
d76c62 |
|
|
|
d76c62 |
/* "sgio" is only valid for block disk; cdrom
|
|
|
d76c62 |
* and floopy disk can have empty source.
|
|
|
d76c62 |
@@ -1859,11 +1859,14 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
|
|
|
d76c62 |
return -1;
|
|
|
d76c62 |
|
|
|
d76c62 |
/* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */
|
|
|
d76c62 |
- if (dev->type == VIR_DOMAIN_DEVICE_DISK)
|
|
|
d76c62 |
- val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
|
|
|
d76c62 |
- else
|
|
|
d76c62 |
- val = (hostdev->source.subsys.u.scsi.sgio ==
|
|
|
d76c62 |
- VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
|
|
|
d76c62 |
+ if (dev->type == VIR_DOMAIN_DEVICE_DISK &&
|
|
|
d76c62 |
+ disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) {
|
|
|
d76c62 |
+ val = 1;
|
|
|
d76c62 |
+ } else {
|
|
|
d76c62 |
+ if (hostdev->source.subsys.u.scsi.sgio ==
|
|
|
d76c62 |
+ VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
|
|
|
d76c62 |
+ val = 1;
|
|
|
d76c62 |
+ }
|
|
|
d76c62 |
|
|
|
d76c62 |
/* Do not do anything if unpriv_sgio is not supported by the kernel and the
|
|
|
d76c62 |
* whitelist is enabled. But if requesting unfiltered access, always call
|
|
|
d76c62 |
--
|
|
|
d76c62 |
2.25.0
|
|
|
d76c62 |
|