]> git.ipfire.org Git - thirdparty/qemu.git/commit
thread-pool: avoid deadlock in nested aio_poll() calls
authorStefan Hajnoczi <stefanha@redhat.com>
Tue, 15 Jul 2014 14:44:26 +0000 (16:44 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 8 Sep 2014 16:23:06 +0000 (11:23 -0500)
commitfeb633411f808f0c876b27ff4bff00a3eceb2073
tree35e4a025d770384eff93f6260a0308457dc64701
parent75ada6b7631bdf5d9f56af845c5096f5d75d33bf
thread-pool: avoid deadlock in nested aio_poll() calls

The thread pool has a race condition if two elements complete before
thread_pool_completion_bh() runs:

  If element A's callback waits for element B using aio_poll() it will
  deadlock since pool->completion_bh is not marked scheduled when the
  nested aio_poll() runs.

Fix this by marking the BH scheduled while thread_pool_completion_bh()
is executing.  This way any nested aio_poll() loops will enter
thread_pool_completion_bh() and complete the remaining elements.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 3c80ca158c96ff902a30883a8933e755988948b1)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
thread-pool.c