From 8e76ebd93fd7525f6909a7da178e9b92c98e1ebe Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 27 Jun 2017 15:51:54 -0400 Subject: [PATCH] librbd: fix missing write block validation in IO work queue Signed-off-by: Jason Dillaman --- src/librbd/io/ImageRequestWQ.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/librbd/io/ImageRequestWQ.cc b/src/librbd/io/ImageRequestWQ.cc index 4ed38eadeb3f..e80e90088d2a 100644 --- a/src/librbd/io/ImageRequestWQ.cc +++ b/src/librbd/io/ImageRequestWQ.cc @@ -467,9 +467,16 @@ void *ImageRequestWQ::_void_dequeue() { RWLock::RLocker locker(m_lock); bool write_op = peek_item->is_write_op(); lock_required = is_lock_required(write_op); - if (write_op && !lock_required && !refresh_required) { - // completed ops will requeue the IO -- don't count it as in-progress - m_in_flight_writes++; + if (write_op) { + if (!lock_required && m_write_blockers > 0) { + // missing lock is not the write blocker + return nullptr; + } + + if (!lock_required && !refresh_required) { + // completed ops will requeue the IO -- don't count it as in-progress + m_in_flight_writes++; + } } } -- 2.47.3