From cea000c6225c809b35b6c643919a01d940522c55 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Fri, 30 Sep 2016 12:32:37 -0400 Subject: [PATCH] librbd: ignore attempts to request lock if already lock owner Signed-off-by: Jason Dillaman (cherry picked from commit 355c79cb7c955e62e3153cf28046a9b8a6d0d25c) --- src/librbd/ImageWatcher.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/librbd/ImageWatcher.cc b/src/librbd/ImageWatcher.cc index 7aeb1c93489c8..6a28c43898b02 100644 --- a/src/librbd/ImageWatcher.cc +++ b/src/librbd/ImageWatcher.cc @@ -443,11 +443,12 @@ void ImageWatcher::notify_request_lock() { RWLock::RLocker owner_locker(m_image_ctx.owner_lock); RWLock::RLocker snap_locker(m_image_ctx.snap_lock); - // ExclusiveLock state machine can be dynamically disabled - if (m_image_ctx.exclusive_lock == nullptr) { + // ExclusiveLock state machine can be dynamically disabled or + // race with task cancel + if (m_image_ctx.exclusive_lock == nullptr || + m_image_ctx.exclusive_lock->is_lock_owner()) { return; } - assert(!m_image_ctx.exclusive_lock->is_lock_owner()); ldout(m_image_ctx.cct, 10) << this << " notify request lock" << dendl; -- 2.39.5