[libvirt] [PATCH v3 0/4] Fix deadlock in nwfilter code

Daniel P. Berrange berrange at redhat.com
Wed Jan 29 14:53:50 UTC 2014


Since we introduced fine grained locking into the QEMU driver so
that VM start can run in parallel, we appear to have caused a
race with the nwfilter code. In particular since we no longer
hold the global QEMU driver lock for the duration of VM startup
we have a lock ordering flaw. This results in deadlock when
nwfilter operations happen in parallel with VM startup. This
also affects the LXC driver.

This patch series attempts to address the problem

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

the removal of the windows thread impl isn't strictly required,
I just didn't want to waste time creating a read/write lock impl
for Windows threads.

See also this callgraph

  http://berrange.fedorapeople.org/nwfilter.ps

In v3:

 - Removed addition of extra lock for serializing
   iptables since it was overkill
 - Added patch to make libvirt compile with mingw32-pthreads
   from Fedora 19 and earlier
 - Fix errno handling with rwlock creation

In v2:

 - Re-ordered patches and squashed two together
 - Add missing locking in state reload function
 - Don't remove locking from virNWFilterInstantiateFilterLate



*** BLURB HERE ***

Daniel P. Berrange (4):
  Add a read/write lock implementation
  Fix pthread_sigmask check for mingw32 without winpthreads
  Remove windows thread implementation in favour of pthreads
  Push nwfilter update locking up to top level

 configure.ac                           |  21 +-
 src/Makefile.am                        |   4 -
 src/conf/nwfilter_conf.c               |  23 +-
 src/conf/nwfilter_conf.h               |   3 +-
 src/libvirt_private.syms               |   8 +-
 src/lxc/lxc_driver.c                   |   6 +
 src/nwfilter/nwfilter_driver.c         |  10 +-
 src/nwfilter/nwfilter_gentech_driver.c |   6 +-
 src/qemu/qemu_driver.c                 |   6 +
 src/uml/uml_driver.c                   |   4 +
 src/util/virthread.c                   | 293 +++++++++++++++++++++++-
 src/util/virthread.h                   |  51 ++++-
 src/util/virthreadpthread.c            | 278 -----------------------
 src/util/virthreadpthread.h            |  49 ----
 src/util/virthreadwin32.c              | 396 ---------------------------------
 src/util/virthreadwin32.h              |  53 -----
 16 files changed, 388 insertions(+), 823 deletions(-)
 delete mode 100644 src/util/virthreadpthread.c
 delete mode 100644 src/util/virthreadpthread.h
 delete mode 100644 src/util/virthreadwin32.c
 delete mode 100644 src/util/virthreadwin32.h

-- 
1.8.4.2




More information about the libvir-list mailing list