]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
librbd: partial revert of commit 9b0e359
authorJason Dillaman <dillaman@redhat.com>
Thu, 3 Dec 2015 12:53:42 +0000 (07:53 -0500)
committerJason Dillaman <dillaman@redhat.com>
Thu, 3 Dec 2015 12:55:16 +0000 (07:55 -0500)
Fixes: #13969
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/ImageWatcher.cc

index 75a82bd0f7270a741d9ab01672420b9fb1a28fac..30dca71acafc2fa6b693f3b73a3c7339b102b105 100644 (file)
@@ -2,7 +2,6 @@
 // vim: ts=8 sw=2 smarttab
 #include "librbd/ImageWatcher.h"
 #include "librbd/AioCompletion.h"
-#include "librbd/AioImageRequestWQ.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/internal.h"
 #include "librbd/ObjectMap.h"
@@ -393,6 +392,7 @@ int ImageWatcher::release_lock()
 
   // ensure all maint operations are canceled
   m_image_ctx.cancel_async_requests();
+  m_image_ctx.flush_async_operations();
 
   int r;
   {
@@ -402,8 +402,12 @@ int ImageWatcher::release_lock()
     // lock is being released
     notify_listeners_updated_lock(LOCK_UPDATE_STATE_RELEASING);
 
-    // AioImageRequestWQ will have blocked writes / flushed IO by this point
-    assert(m_image_ctx.aio_work_queue->writes_blocked());
+    RWLock::WLocker md_locker(m_image_ctx.md_lock);
+    r = m_image_ctx.flush();
+    if (r < 0) {
+      lderr(cct) << this << " failed to flush: " << cpp_strerror(r) << dendl;
+      goto err_cancel_unlock;
+    }
   }
 
   m_image_ctx.owner_lock.get_write();
@@ -426,6 +430,13 @@ int ImageWatcher::release_lock()
   }
 
   return 0;
+
+err_cancel_unlock:
+  m_image_ctx.owner_lock.get_write();
+  if (m_lock_owner_state == LOCK_OWNER_STATE_RELEASING) {
+    m_lock_owner_state = LOCK_OWNER_STATE_LOCKED;
+  }
+  return r;
 }
 
 void ImageWatcher::assert_header_locked(librados::ObjectWriteOperation *op) {