Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > ebe084c140192657f9094e135a84202c > files > 101

libvirt-0.8.2-29.el5.src.rpm

From ace932ceb9e21ba4e1b49e570f0c1fff8106ccf2 Mon Sep 17 00:00:00 2001
Message-Id: <ace932ceb9e21ba4e1b49e570f0c1fff8106ccf2.1284409900.git.jdenemar@redhat.com>
From: Chris Wright <chrisw@redhat.com>
Date: Fri, 23 Jul 2010 11:25:24 +0200
Subject: [PATCH] pciSharesBusWithActive fails to find multiple devices on bus

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=630620

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.

* src/util/pci.c: fix a bogus test in pciSharesBusWithActive()
(cherry picked from commit f4828ca353aabd559f196cedbca1daecf4e0609b)
---
 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))
-- 
1.7.2.2