From: Jason Dillaman Date: Wed, 26 Aug 2015 18:33:13 +0000 (-0400) Subject: librbd: remove AsyncRequest::safely_cancel X-Git-Tag: v10.0.2~193^2~33 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a701d5e8aef11d43c016f95d791b82182488712a;p=ceph.git librbd: remove AsyncRequest::safely_cancel Long-running operations controlled via the AsyncObjectThrottle will automatically cancel with an -ERESTART return code when requested. Other states are transitional and have a high-potential for race conditions if aborted between states. Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/AsyncRequest.h b/src/librbd/AsyncRequest.h index 241c90e8210..5ecaf8202fe 100644 --- a/src/librbd/AsyncRequest.h +++ b/src/librbd/AsyncRequest.h @@ -21,10 +21,7 @@ public: virtual ~AsyncRequest(); void complete(int r) { - if (m_canceled && safely_cancel(r)) { - m_on_finish->complete(-ERESTART); - delete this; - } else if (should_complete(r)) { + if (should_complete(r)) { m_on_finish->complete(filter_return_code(r)); delete this; } @@ -49,9 +46,6 @@ protected: void async_complete(int r); - virtual bool safely_cancel(int r) { - return true; - } virtual bool should_complete(int r) = 0; virtual int filter_return_code(int r) { return r; diff --git a/src/librbd/ObjectMap.h b/src/librbd/ObjectMap.h index 1737e124668..c85703a286f 100644 --- a/src/librbd/ObjectMap.h +++ b/src/librbd/ObjectMap.h @@ -72,9 +72,6 @@ private: protected: const uint64_t m_snap_id; - virtual bool safely_cancel(int r) { - return false; - } virtual bool should_complete(int r); virtual int filter_return_code(int r) { // never propagate an error back to the caller diff --git a/src/librbd/ResizeRequest.cc b/src/librbd/ResizeRequest.cc index 5b08a4ebf1b..186e730f39d 100644 --- a/src/librbd/ResizeRequest.cc +++ b/src/librbd/ResizeRequest.cc @@ -42,23 +42,6 @@ ResizeRequest::~ResizeRequest() { } } -bool ResizeRequest::safely_cancel(int r) { - CephContext *cct = m_image_ctx.cct; - ldout(cct, 5) << this << " safely_cancel: " << " r=" << r << dendl; - - // avoid interrupting the object map / header updates - switch (m_state) { - case STATE_GROW_OBJECT_MAP: - case STATE_UPDATE_HEADER: - case STATE_SHRINK_OBJECT_MAP: - ldout(cct, 5) << "delaying cancel request" << dendl; - return false; - default: - break; - } - return true; -} - bool ResizeRequest::should_complete(int r) { CephContext *cct = m_image_ctx.cct; ldout(cct, 5) << this << " should_complete: " << " r=" << r << dendl; diff --git a/src/librbd/ResizeRequest.h b/src/librbd/ResizeRequest.h index 23abefed7d6..8a0447858b2 100644 --- a/src/librbd/ResizeRequest.h +++ b/src/librbd/ResizeRequest.h @@ -82,7 +82,6 @@ private: xlist::item m_xlist_item; - virtual bool safely_cancel(int r); virtual bool should_complete(int r); void send_flush();