[libvirt] [PATCH] nwfilter: fix lock order deadlock

Maxim Nestratov mnestratov at virtuozzo.com
Tue Apr 19 17:32:23 UTC 2016


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 at virtuozzo.com>
> ---
>   src/nwfilter/nwfilter_learnipaddr.c | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)

No one interested?




More information about the libvir-list mailing list