]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: ignore attempts to request lock if already lock owner
authorJason Dillaman <dillaman@redhat.com>
Fri, 30 Sep 2016 16:32:37 +0000 (12:32 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 11 Oct 2016 17:57:13 +0000 (13:57 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 355c79cb7c955e62e3153cf28046a9b8a6d0d25c)

src/librbd/ImageWatcher.cc

index 7aeb1c93489c8b65733cf1d190d96bbfc299be79..6a28c43898b02be40d6ffd014aacb3d7fa9e1ff7 100644 (file)
@@ -443,11 +443,12 @@ void ImageWatcher<I>::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;