]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/ObjectStore: do not let Sequencer::flush_commit delete the context
authorSage Weil <sage@redhat.com>
Mon, 17 Aug 2015 19:09:47 +0000 (15:09 -0400)
committerSage Weil <sage@redhat.com>
Wed, 19 Aug 2015 21:03:54 +0000 (17:03 -0400)
Let the caller manage the lifecycle; this allows us to potentially put it
on the stack, for instance.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/FileStore.h
src/os/KeyValueStore.h
src/os/ObjectStore.h
src/osd/PG.cc

index 3775fbac3c71d22ea63391385ebd09462a5b46de..710a1ad8c90d10dd1fb7b5b8dfd3b8bdbff78a34 100644 (file)
@@ -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));
index 48135f142c3fda223aa9b047dde0e85f9cc374d0..a4a402837c4f9f19dbde19a4a6f17bd5f44dd5b9 100644 (file)
@@ -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));
index 201ec30a083eed827528591b4b9cbf6fefeb7c30..5b72165360b1297c35970aaa46df3b2dd89b3ee4 100644 (file)
@@ -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);
index 9eca0b1dd464ef0219613eb4a351eac60142f8d2..23961f0df610044188403df2e4fb0b082200fcd9 100644 (file)
@@ -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<IntervalFlush>(
-       this, get_osdmap()->get_epoch(), IntervalFlush()))) {
+  Context *c = new QueuePeeringEvt<IntervalFlush>(
+    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;
   }
 }