Skip to content
  • Stefan Hajnoczi's avatar
    thread-pool: avoid deadlock in nested aio_poll() calls · 3c80ca15
    Stefan Hajnoczi authored
    
    
    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: default avatarStefan Hajnoczi <stefanha@redhat.com>
    3c80ca15