From: Sage Weil Date: Fri, 10 Apr 2015 22:29:16 +0000 (-0700) Subject: os/newstore: do not call completions from kv thread X-Git-Tag: v9.1.0~242^2~78 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=93fa4f1e30bdeed54a7cef7557f4702e89b7c570;p=ceph.git os/newstore: do not call completions from kv thread Reads may call wait_wal() holding user locks, and so we cannot block progress on WAL completion/flushing by calling callbacks that may take user locks. Signed-off-by: Sage Weil --- diff --git a/src/os/newstore/NewStore.cc b/src/os/newstore/NewStore.cc index daaee2183ac0..925a6ec72e82 100644 --- a/src/os/newstore/NewStore.cc +++ b/src/os/newstore/NewStore.cc @@ -2096,27 +2096,23 @@ void NewStore::_txc_finish_kv(TransContext *txc) txc->osr->qlock.Lock(); txc->state = TransContext::STATE_KV_DONE; - // loop in case we race with OpSequencer::flush_commit() - do { - txc->osr->qlock.Unlock(); - if (txc->onreadable_sync) { - txc->onreadable_sync->complete(0); - txc->onreadable_sync = NULL; - } - if (txc->onreadable) { - finisher.queue(txc->onreadable); - txc->onreadable = NULL; - } - if (txc->oncommit) { - txc->oncommit->complete(0); - txc->oncommit = NULL; - } - while (!txc->oncommits.empty()) { - txc->oncommits.front()->complete(0); - txc->oncommits.pop_front(); - } - txc->osr->qlock.Lock(); - } while (txc->oncommit || !txc->oncommits.empty()); + // warning: we're calling onreadable_sync inside the sequencer lock + if (txc->onreadable_sync) { + txc->onreadable_sync->complete(0); + txc->onreadable_sync = NULL; + } + if (txc->onreadable) { + finisher.queue(txc->onreadable); + txc->onreadable = NULL; + } + if (txc->oncommit) { + finisher.queue(txc->oncommit); + txc->oncommit = NULL; + } + while (!txc->oncommits.empty()) { + finisher.queue(txc->oncommits.front()); + txc->oncommits.pop_front(); + } if (txc->wal_txn) { dout(20) << __func__ << " starting wal apply" << dendl;