]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/newstore: do not call completions from kv thread
authorSage Weil <sage@redhat.com>
Fri, 10 Apr 2015 22:29:16 +0000 (15:29 -0700)
committerSage Weil <sage@redhat.com>
Tue, 1 Sep 2015 17:39:37 +0000 (13:39 -0400)
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 <sage@redhat.com>
src/os/newstore/NewStore.cc

index daaee2183ac0540790ea81eb958037d10ca29120..925a6ec72e821f41c1613b585b4c6d0f2f7bd4a5 100644 (file)
@@ -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;