[PATCH 09/10] qemu: Do not restore the sysfs unpriv_sgio if the disk is being shared

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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_conf.c    |    6 ++++++
 src/qemu/qemu_process.c |   11 +++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 98eb1b5..d214ffe 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -765,6 +765,9 @@ qemuSharedDiskListFree(qemuSharedDiskListPtr list)
 
 /* Return the matched entry on success, with @idx set as
  * the index of the matched entry. Or NULL on failure.
+ *
+ * If @domain_name is passed as NULL, it simply returns
+ * the entry which matches the @disk_path.
  */
 qemuSharedDiskPtr
 qemuSharedDiskListFind(qemuSharedDiskListPtr list,
@@ -777,6 +780,9 @@ qemuSharedDiskListFind(qemuSharedDiskListPtr list,
 
     for (i = 0; i < list->ndisks; i++) {
         if (STREQ(disk_path, list->disks[i]->path)) {
+            if (!domain_name)
+                return list->disks[i];
+
             for (j = 0; j < list->disks[i]->ndomains; j++) {
                 if (STREQ(domain_name, list->disks[i]->domains[j])) {
                     *idx = i;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 13fce78..7ac83b5 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4139,6 +4139,17 @@ void qemuProcessStop(struct qemud_driver *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.7.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]