From: Sage Weil Date: Mon, 17 Aug 2015 19:09:47 +0000 (-0400) Subject: os/ObjectStore: do not let Sequencer::flush_commit delete the context X-Git-Tag: v9.1.0~324^2~30 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8ac59239e3f386f766a05c49e5d90ec58f78f8f9;p=ceph.git os/ObjectStore: do not let Sequencer::flush_commit delete the context Let the caller manage the lifecycle; this allows us to potentially put it on the stack, for instance. Signed-off-by: Sage Weil --- diff --git a/src/os/FileStore.h b/src/os/FileStore.h index 3775fbac3c7..710a1ad8c90 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -304,7 +304,6 @@ private: Mutex::Locker l(qlock); uint64_t seq = 0; if (_get_max_uncompleted(&seq)) { - delete c; return true; } else { flush_commit_waiters.push_back(make_pair(seq, c)); diff --git a/src/os/KeyValueStore.h b/src/os/KeyValueStore.h index 48135f142c3..a4a402837c4 100644 --- a/src/os/KeyValueStore.h +++ b/src/os/KeyValueStore.h @@ -407,7 +407,6 @@ class KeyValueStore : public ObjectStore, Mutex::Locker l(qlock); uint64_t seq = 0; if (_get_max_uncompleted(&seq)) { - delete c; return true; } else { flush_commit_waiters.push_back(make_pair(seq, c)); diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 201ec30a083..5b72165360b 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -144,8 +144,8 @@ public: * Async flush_commit * * There are two cases: - * 1) sequencer is currently idle: the method returns true and - * c is deleted + * 1) sequencer is currently idle: the method returns true. c is + * not touched. * 2) sequencer is not idle: the method returns false and c is * called asyncronously with a value of 0 once all transactions * queued on this sequencer prior to the call have been applied @@ -185,7 +185,6 @@ public: /// @see Sequencer_impl::flush_commit() bool flush_commit(Context *c) { if (!p) { - delete c; return true; } else { return p->flush_commit(c); diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 9eca0b1dd46..23961f0df61 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -4622,13 +4622,14 @@ void PG::reset_interval_flush() dout(10) << "Clearing blocked outgoing recovery messages" << dendl; recovery_state.clear_blocked_outgoing(); - if (!osr->flush_commit( - new QueuePeeringEvt( - this, get_osdmap()->get_epoch(), IntervalFlush()))) { + Context *c = new QueuePeeringEvt( + this, get_osdmap()->get_epoch(), IntervalFlush()); + if (!osr->flush_commit(c)) { dout(10) << "Beginning to block outgoing recovery messages" << dendl; recovery_state.begin_block_outgoing(); } else { dout(10) << "Not blocking outgoing recovery messages" << dendl; + delete c; } }