]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/newstore: ref count OpSequencer
authorSage Weil <sage@redhat.com>
Wed, 1 Apr 2015 21:44:45 +0000 (14:44 -0700)
committerSage Weil <sage@redhat.com>
Tue, 1 Sep 2015 17:39:35 +0000 (13:39 -0400)
Our OpSequencer may live longer than the ObjectStore::Sequencer interface
object does.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/newstore/NewStore.cc
src/os/newstore/NewStore.h

index a0ce422f4a854def13c6fca02df0de868e9f1725..62a61f08e466f9cc7eaa9a09fc3603bc2cee8298 100644 (file)
@@ -2048,7 +2048,7 @@ void NewStore::_txc_finish_fsync(TransContext *txc)
    * even though fsyncs will complete in any order.
    */
 
-  OpSequencer *osr = txc->osr;
+  OpSequencer *osr = txc->osr.get();
   Mutex::Locker l(osr->qlock);
   txc->state = TransContext::STATE_FSYNC_DONE;
 
@@ -2200,12 +2200,12 @@ void NewStore::_txc_finish_apply(TransContext *txc)
     txc->removed_collections.pop_front();
   }
 
-  OpSequencer *osr = txc->osr;
+  OpSequencerRef osr = txc->osr;
   osr->qlock.Lock();
   txc->state = TransContext::STATE_DONE;
   osr->qlock.Unlock();
 
-  _osr_reap_done(osr);
+  _osr_reap_done(osr.get());
 }
 
 void NewStore::_osr_reap_done(OpSequencer *osr)
index 88694b51cba693997f32d2a8a7aca84ffe7561f1..e40bf0bb6cee9e5a40d0394df136feaa3043de9c 100644 (file)
@@ -147,6 +147,7 @@ public:
   };
 
   class OpSequencer;
+  typedef boost::intrusive_ptr<OpSequencer> OpSequencerRef;
 
   struct fsync_item {
     boost::intrusive::list_member_hook<> queue_item;
@@ -191,7 +192,7 @@ public:
       return "???";
     }
 
-    OpSequencer *osr;
+    OpSequencerRef osr;
     boost::intrusive::list_member_hook<> sequencer_item;
 
     list<fsync_item> fds;     ///< these fds need to be synced
@@ -717,4 +718,11 @@ static inline void intrusive_ptr_release(NewStore::Onode *o) {
   o->put();
 }
 
+static inline void intrusive_ptr_add_ref(NewStore::OpSequencer *o) {
+  o->get();
+}
+static inline void intrusive_ptr_release(NewStore::OpSequencer *o) {
+  o->put();
+}
+
 #endif