[PATCH] pciSharesBusWithActive fails to find multiple devices on bus

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

 



The first conditional is always true which means the iterator will
never find another device on the same bus.

    if (dev->domain != check->domain ||
        dev->bus != check->bus ||
  ----> (check->slot == check->slot &&
         check->function == check->function)) <-----

The goal of that check is to verify that the device is either:

  in a different pci domain
  on a different bus
  is the same identical device

This means libvirt may issue a secondary bus reset when there are devices
on that bus that actively in use by the host or another guest.  Not good.
Fix the typo.

Cc: Alex Williamson <alex.williamson@xxxxxxxxxx>
Cc: Don Dutile <ddutile@xxxxxxxxxx>
Cc: Chris Lalancette <clalance@xxxxxxxxxx>
Signed-off-by: Chris Wright <chrisw@xxxxxxxxxx>
---
 src/util/pci.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/util/pci.c b/src/util/pci.c
index b2e1673..6d0ca24 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -446,10 +446,11 @@ pciSharesBusWithActive(pciDevice *dev, pciDevice *check, void *data)
 {
     pciDeviceList *activeDevs = data;
 
+    /* Different domain, different bus, or simply identical device */
     if (dev->domain != check->domain ||
         dev->bus != check->bus ||
-        (check->slot == check->slot &&
-         check->function == check->function))
+        (dev->slot == check->slot &&
+         dev->function == check->function))
         return 0;
 
     if (activeDevs && !pciDeviceListFind(activeDevs, check))

--
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]