From: Jason Dillaman Date: Fri, 10 Apr 2015 16:37:05 +0000 (-0400) Subject: librbd: failure to update the object map should always return success X-Git-Tag: v0.94.2~17^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F4564%2Fhead;p=ceph.git librbd: failure to update the object map should always return success If an object map update fails, the object map will be flagged as invalid. However, if a subsequent update failure occurs, the error code will propagate back to the caller. Fixes: #11369 Signed-off-by: Jason Dillaman (cherry picked from commit 99f5a7d595c653447b351898192410c9cb773770) --- diff --git a/src/librbd/AsyncRequest.h b/src/librbd/AsyncRequest.h index f81840a0f77..fd260a912c9 100644 --- a/src/librbd/AsyncRequest.h +++ b/src/librbd/AsyncRequest.h @@ -23,7 +23,7 @@ public: m_on_finish->complete(-ERESTART); delete this; } else if (should_complete(r)) { - m_on_finish->complete(r); + m_on_finish->complete(filter_return_code(r)); delete this; } } @@ -48,7 +48,9 @@ protected: return true; } virtual bool should_complete(int r) = 0; - + virtual int filter_return_code(int r) { + return r; + } private: bool m_canceled; xlist::item m_xlist_item; diff --git a/src/librbd/ObjectMap.h b/src/librbd/ObjectMap.h index 564816f1193..596f5cf6f4b 100644 --- a/src/librbd/ObjectMap.h +++ b/src/librbd/ObjectMap.h @@ -59,6 +59,10 @@ private: protected: virtual bool should_complete(int r); + virtual int filter_return_code(int r) { + // never propagate an error back to the caller + return 0; + } virtual void finish(ObjectMap *object_map) = 0; private: @@ -76,7 +80,7 @@ private: State m_state; bool invalidate(); - }; + }; class ResizeRequest : public Request { public: