Re: [PATCH] nwfilter: fix lock order deadlock

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

 



09.04.2016 19:14, Maxim Nestratov пишет:

Below is backtraces of two deadlocked threads:

thread #1:
  virDomainConfVMNWFilterTeardown
    virNWFilterTeardownFilter
        lock updateMutex <------------
        _virNWFilterTeardownFilter
             try to lock interface <----------

thread #2:
  learnIPAddressThread
     lock interface <-------
     virNWFilterInstantiateFilterLate
         try to lock updateMutex <----------

The problem is fixed by unlocking interface before calling
virNWFilterInstantiateFilterLate to avoid updateMutex and interface ordering
deadlocks. Otherwise we are going to instantiate the filter while holding
interface lock, which will try to lock updateMutex, and if some other thread
instantiating a filter in parallel is holding updateMutex and is trying to
lock interface, both will deadlock.
Also it is safe to unlock interface before virNWFilterInstantiateFilterLate
because learnIPAddressThread stopped capturing packets and applied necessary
rules on the interface, while instantiating a new filter doesn't require a
locked interface.

Signed-off-by: Maxim Nestratov <mnestratov@xxxxxxxxxxxxx>
---
  src/nwfilter/nwfilter_learnipaddr.c | 12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)

No one interested?

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