]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/kstore: fix a race condition in _txc_finish() 7804/head
authorJianjian Huo <samuel.huo@gmail.com>
Thu, 25 Feb 2016 15:24:16 +0000 (07:24 -0800)
committerJianjian Huo <samuel.huo@gmail.com>
Thu, 25 Feb 2016 15:24:16 +0000 (07:24 -0800)
{} was missed, which limits the scope of the lock_guard.
osr->qlock has to be unlocked before calling _osr_reap_done(), since _osr_reap_done
needs acquire osr->qlock in the first beginning.

Signed-off-by: Jianjian Huo <samuel.huo@gmail.com>
src/os/kstore/KStore.cc

index 729cd14edbdf88351423014d88b8e7e32d15a859..97ce03eb44605f7fb1c3f9dfadbf76a8b48e22ef 100644 (file)
@@ -2280,8 +2280,10 @@ void KStore::_txc_finish(TransContext *txc)
   }
 
   OpSequencerRef osr = txc->osr;
-  std::lock_guard<std::mutex> l(osr->qlock);
-  txc->state = TransContext::STATE_DONE;
+  {
+    std::lock_guard<std::mutex> l(osr->qlock);
+    txc->state = TransContext::STATE_DONE;
+  }
 
   _osr_reap_done(osr.get());
 }