]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: remove AsyncRequest::safely_cancel
authorJason Dillaman <dillaman@redhat.com>
Wed, 26 Aug 2015 18:33:13 +0000 (14:33 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 17 Nov 2015 20:05:38 +0000 (15:05 -0500)
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 <dillaman@redhat.com>
src/librbd/AsyncRequest.h
src/librbd/ObjectMap.h
src/librbd/ResizeRequest.cc
src/librbd/ResizeRequest.h

index 241c90e8210a2dafd6bada1a661c03daacf9c7b7..5ecaf8202fecd0b1018551d85157ef902eea9839 100644 (file)
@@ -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;
index 1737e1246684daed5826afcf7d870195e7d0c6d8..c85703a286feb0a724ca4dd4b2195db6df44fcd8 100644 (file)
@@ -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
index 5b08a4ebf1bd7bde9a9596680f98add02c877fad..186e730f39d404a53e5513b11f7a64a345ed5607 100644 (file)
@@ -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;
index 23abefed7d6c4cc43b5aad32f39fb805ffe42465..8a0447858b2337f520e419d8a2c974a7df778ab2 100644 (file)
@@ -82,7 +82,6 @@ private:
 
   xlist<ResizeRequest *>::item m_xlist_item;
 
-  virtual bool safely_cancel(int r);
   virtual bool should_complete(int r);
 
   void send_flush();