]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: skip invalidating an invalid object map
authorJason Dillaman <dillaman@redhat.com>
Wed, 4 Feb 2015 07:50:57 +0000 (02:50 -0500)
committerJosh Durgin <jdurgin@redhat.com>
Mon, 16 Feb 2015 21:27:35 +0000 (13:27 -0800)
If the object map is already flagged as invalid, avoid
attempting to set the invalid object map flag again.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/ObjectMap.cc
src/librbd/ObjectMap.h

index 6b2be6389cc49253ec6cb4710ea815493bfb9dea..a3eec40a9959d0c132752f8463259b9923863091 100644 (file)
@@ -210,6 +210,10 @@ bool ObjectMap::aio_update(uint64_t start_object_no, uint64_t end_object_no,
 }
 
 void ObjectMap::invalidate() {
+  if ((m_image_ctx.flags & RBD_FLAG_OBJECT_MAP_INVALID) != 0) {
+    return;
+  }
+
   CephContext *cct = m_image_ctx.cct;
   lderr(cct) << &m_image_ctx << " invalidating object map" << dendl;
   m_image_ctx.flags |= RBD_FLAG_OBJECT_MAP_INVALID;
@@ -237,8 +241,7 @@ bool ObjectMap::Request::should_complete(int r) {
     } else if (r < 0) {
       lderr(cct) << "failed to update object map: " << cpp_strerror(r)
                 << dendl;
-      invalidate();
-      return false;
+      return invalidate();
     }
 
     {
@@ -267,7 +270,11 @@ bool ObjectMap::Request::should_complete(int r) {
   return false;
 }
 
-void ObjectMap::Request::invalidate() {
+bool ObjectMap::Request::invalidate() {
+  if ((m_image_ctx.flags & RBD_FLAG_OBJECT_MAP_INVALID) != 0) {
+    return true;
+  }
+
   CephContext *cct = m_image_ctx.cct;
   RWLock::WLocker l(m_image_ctx.md_lock);
 
@@ -283,6 +290,7 @@ void ObjectMap::Request::invalidate() {
                                         rados_completion, &op);
   assert(r == 0);
   rados_completion->release();
+  return false;
 }
 
 void ObjectMap::ResizeRequest::send() {
index 29eac9730af9bc497861b5b8e064dca441917fb2..0c476448d3c339a0ab61f11a7a5586c38986b2a0 100644 (file)
@@ -68,7 +68,7 @@ private:
 
     State m_state;
 
-    void invalidate();
+    bool invalidate();
   }; 
 
   class ResizeRequest : public Request {