]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: cancel context correctly if we already have required osdmap in hand
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 14 Jun 2016 12:29:53 +0000 (20:29 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 14 Jun 2016 12:40:14 +0000 (20:40 +0800)
By simply deleting the fin, the callbacks will be requeued into
the specified finisher and recalled later, which is not the expected
behaviour.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/common/Finisher.h
src/mds/MDSContext.h

index 4d494ed15333d92802c29d12a593462884829613..ffdddf632e8d3726bbc0a48367cc1a1ed87ae140 100644 (file)
@@ -173,8 +173,17 @@ public:
     assert(fin != NULL);
     assert(con != NULL);
   }
+
+  ~C_OnFinisher() {
+    if (con != nullptr) {
+      delete con;
+      con = nullptr;
+    }
+  }
+
   void finish(int r) {
     fin->queue(con, r);
+    con = nullptr;
   }
 };
 
index d26d1bdb783a6ccdeead1ea497bb9ba0e02550b6..a69223dc7b3eb7c4a464b5ac989dd10d65351c76 100644 (file)
@@ -135,8 +135,17 @@ public:
   C_IO_Wrapper(MDSRank *mds_, MDSInternalContextBase *wrapped_) : MDSIOContext(mds_), wrapped(wrapped_) {
     assert(wrapped != NULL);
   }
+
+  ~C_IO_Wrapper() {
+    if (wrapped != nullptr) {
+      delete wrapped;
+      wrapped = nullptr;
+    }
+  }
+
   virtual void finish(int r) {
     wrapped->complete(r);
+    wrapped = nullptr;
   }
 };