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

Daniel P. Berrange berrange at redhat.com
Mon Jan 27 17:18:17 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 v2:

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

Daniel P. Berrange (4):
  Add a read/write lock implementation
  Remove windows thread implementation in favour of pthreads
  Add a mutex to serialize updates to firewall
  Push nwfilter update locking up to top level

 configure.ac                           |  15 +-
 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         |  15 +-
 src/nwfilter/nwfilter_gentech_driver.c |  23 +-
 src/nwfilter/nwfilter_gentech_driver.h |   2 +-
 src/qemu/qemu_driver.c                 |   6 +
 src/uml/uml_driver.c                   |   4 +
 src/util/virthread.c                   | 291 +++++++++++++++++++++++-
 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 -----
 17 files changed, 404 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