]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: separate finisher for deferred_try_submit 17494/head
authorSage Weil <sage@redhat.com>
Thu, 31 Aug 2017 20:43:39 +0000 (16:43 -0400)
committerNathan Cutler <ncutler@suse.com>
Tue, 5 Sep 2017 15:12:26 +0000 (17:12 +0200)
Reusing finishers[0], which is used for completions back into the OSD,
is deadlock-prone: the OSD code might block trying to submit new IO or
while waiting for some other bluestore work to complete.

Fixes: http://tracker.ceph.com/issues/21207
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 2b6a9d1ec0778f66b6e9d9f216df21a00caeba3f)

src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index b87d0302b306a9fc5526e001391e0f67cf9f2b4d..2034a5295539ab4e5f68cfa8b13aef5c50f46fdf 100644 (file)
@@ -3474,6 +3474,7 @@ BlueStore::BlueStore(CephContext *cct, const string& path)
     throttle_deferred_bytes(cct, "bluestore_throttle_deferred_bytes",
                       cct->_conf->bluestore_throttle_bytes +
                       cct->_conf->bluestore_throttle_deferred_bytes),
+    deferred_finisher(cct, "defered_finisher", "dfin"),
     kv_sync_thread(this),
     kv_finalize_thread(this),
     mempool_thread(this)
@@ -3492,6 +3493,7 @@ BlueStore::BlueStore(CephContext *cct,
     throttle_deferred_bytes(cct, "bluestore_throttle_deferred_bytes",
                       cct->_conf->bluestore_throttle_bytes +
                       cct->_conf->bluestore_throttle_deferred_bytes),
+    deferred_finisher(cct, "defered_finisher", "dfin"),
     kv_sync_thread(this),
     kv_finalize_thread(this),
     min_alloc_size(_min_alloc_size),
@@ -8292,6 +8294,7 @@ void BlueStore::_kv_start()
     finishers.push_back(f);
   }
 
+  deferred_finisher.start();
   for (auto f : finishers) {
     f->start();
   }
@@ -8329,6 +8332,8 @@ void BlueStore::_kv_stop()
     kv_finalize_stop = false;
   }
   dout(10) << __func__ << " stopping finishers" << dendl;
+  deferred_finisher.wait_for_empty();
+  deferred_finisher.stop();
   for (auto f : finishers) {
     f->wait_for_empty();
     f->stop();
@@ -8773,7 +8778,7 @@ void BlueStore::_deferred_aio_finish(OpSequencer *osr)
       deferred_queue.erase(q);
     } else if (deferred_aggressive) {
       dout(20) << __func__ << " queuing async deferred_try_submit" << dendl;
-      finishers[0]->queue(new FunctionContext([&](int) {
+      deferred_finisher.queue(new FunctionContext([&](int) {
            deferred_try_submit();
          }));
     }
index 8c5eb4a02b4e5de2b3c7a3f00d49f2a4633194eb..d0de456d422aadeb2a4b2d5dda10d804512fb467 100644 (file)
@@ -1846,6 +1846,7 @@ private:
   deferred_osr_queue_t deferred_queue; ///< osr's with deferred io pending
   int deferred_queue_size = 0;         ///< num txc's queued across all osrs
   atomic_int deferred_aggressive = {0}; ///< aggressive wakeup of kv thread
+  Finisher deferred_finisher;
 
   int m_finisher_num = 1;
   vector<Finisher*> finishers;