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