From: Jason Dillaman Date: Wed, 4 Feb 2015 07:50:57 +0000 (-0500) Subject: librbd: skip invalidating an invalid object map X-Git-Tag: v0.93~38^2~1^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=32e259c56c1ece5ca561dbd4d078f7e34c42bf30;p=ceph.git librbd: skip invalidating an invalid object map If the object map is already flagged as invalid, avoid attempting to set the invalid object map flag again. Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/ObjectMap.cc b/src/librbd/ObjectMap.cc index 6b2be6389cc4..a3eec40a9959 100644 --- a/src/librbd/ObjectMap.cc +++ b/src/librbd/ObjectMap.cc @@ -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() { diff --git a/src/librbd/ObjectMap.h b/src/librbd/ObjectMap.h index 29eac9730af9..0c476448d3c3 100644 --- a/src/librbd/ObjectMap.h +++ b/src/librbd/ObjectMap.h @@ -68,7 +68,7 @@ private: State m_state; - void invalidate(); + bool invalidate(); }; class ResizeRequest : public Request {