From: xie xingguo Date: Tue, 14 Jun 2016 12:29:53 +0000 (+0800) Subject: mds: cancel context correctly if we already have required osdmap in hand X-Git-Tag: v11.0.0~175^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4828b2f205898358c1c81f6a56ebd10aa28685b3;p=ceph.git mds: cancel context correctly if we already have required osdmap in hand 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 --- diff --git a/src/common/Finisher.h b/src/common/Finisher.h index 4d494ed15333..ffdddf632e8d 100644 --- a/src/common/Finisher.h +++ b/src/common/Finisher.h @@ -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; } }; diff --git a/src/mds/MDSContext.h b/src/mds/MDSContext.h index d26d1bdb783a..a69223dc7b3e 100644 --- a/src/mds/MDSContext.h +++ b/src/mds/MDSContext.h @@ -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; } };