From: Sage Weil Date: Tue, 3 Oct 2017 21:48:37 +0000 (-0500) Subject: os/bluestore: use normal Context for async deferred_try_submit X-Git-Tag: v12.2.2~170^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7986d4566a1f6d8e22a9acd19608530ce64cbfa1;p=ceph.git os/bluestore: use normal Context for async deferred_try_submit I'm not quite sure why the FunctionContext did not ever execute on the finisher thread (perhaps the [&] captured some state on the stack that it shouldn't have?). In any case, using a traditional Context here appears to resolve the problem (of the async deferred_try_submit() never executing, leading to a bluestore stall/deadlock). Fixes: http://tracker.ceph.com/issues/21470 Signed-off-by: Sage Weil (cherry picked from commit 67ec75805787ed63b35f8d70478a7a2cd785df06) --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index b46b06ae410a..a28efdcd90c4 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -8707,6 +8707,14 @@ void BlueStore::_deferred_submit_unlock(OpSequencer *osr) bdev->aio_submit(&b->ioc); } +struct C_DeferredTrySubmit : public Context { + BlueStore *store; + C_DeferredTrySubmit(BlueStore *s) : store(s) {} + void finish(int r) { + store->deferred_try_submit(); + } +}; + void BlueStore::_deferred_aio_finish(OpSequencer *osr) { dout(10) << __func__ << " osr " << osr << dendl; @@ -8723,9 +8731,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; - deferred_finisher.queue(new FunctionContext([&](int) { - deferred_try_submit(); - })); + deferred_finisher.queue(new C_DeferredTrySubmit(this)); } else { dout(20) << __func__ << " leaving queued, more pending" << dendl; } diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 102c1e215557..311107c18b40 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -2036,7 +2036,9 @@ private: bluestore_deferred_op_t *_get_deferred_op(TransContext *txc, OnodeRef o); void _deferred_queue(TransContext *txc); +public: void deferred_try_submit(); +private: void _deferred_submit_unlock(OpSequencer *osr); void _deferred_aio_finish(OpSequencer *osr); int _deferred_replay();