From 9dbac6c3b36741f3480cecca3c421bc3338d8633 Mon Sep 17 00:00:00 2001 From: Jianjian Huo Date: Thu, 25 Feb 2016 07:24:16 -0800 Subject: [PATCH] os/kstore: fix a race condition in _txc_finish() {} 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 --- src/os/kstore/KStore.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/os/kstore/KStore.cc b/src/os/kstore/KStore.cc index 729cd14edbdf..97ce03eb4460 100644 --- a/src/os/kstore/KStore.cc +++ b/src/os/kstore/KStore.cc @@ -2280,8 +2280,10 @@ void KStore::_txc_finish(TransContext *txc) } OpSequencerRef osr = txc->osr; - std::lock_guard l(osr->qlock); - txc->state = TransContext::STATE_DONE; + { + std::lock_guard l(osr->qlock); + txc->state = TransContext::STATE_DONE; + } _osr_reap_done(osr.get()); } -- 2.47.3