The various IO callback codepaths will attempt to take
the lock, which will result in deadlock since the flush
cannot complete.
Backport: hammer
Fixes: #11537
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit
2b6d0633d5c89de3a557cdd72621dfc19f0540de)
return false;
}
prepare_unlock();
-
m_image_ctx.owner_lock.put_write();
m_image_ctx.cancel_async_requests();
m_image_ctx.flush_async_operations();
- m_image_ctx.owner_lock.get_write();
-
- if (!is_lock_owner()) {
- return false;
- }
{
- RWLock::WLocker l2(m_image_ctx.md_lock);
+ RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
+ RWLock::WLocker md_locker(m_image_ctx.md_lock);
librbd::_flush(&m_image_ctx);
}
+ m_image_ctx.owner_lock.get_write();
+ if (!is_lock_owner()) {
+ return false;
+ }
+
unlock();
return true;
}