This prevents restoring the unpriv_sgio if the disk is shared,
and is being used by other active domain. Because we don't want
to fall into the corruption situation.
---
src/qemu/qemu_process.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index b991a22..5cb068e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4139,6 +4139,17 @@ void qemuProcessStop(virQEMUDriverPtr driver,
if (!disk->cdbfilter)
continue;
+ /* Don't try to restore the unpriv_sgio if the disk is shared
+ * by other active domain(s). We don't want to fall into the
+ * corruptions.
+ */
+ if (disk->shared &&
+ qemuSharedDiskListFind(driver->sharedDisks,
+ disk->src,
+ NULL,
+ NULL))
+ continue;
+
/* Restore sysfs unpriv_sgio for the disk */
if (disk->old_cdbfilter == VIR_DOMAIN_DISK_CDB_FILTER_YES)
val = 0;
--
1.7.1