From: Jason Dillaman Date: Tue, 8 Dec 2020 14:58:07 +0000 (-0500) Subject: librbd/io: flush IO before shutting down image IO dispatchers X-Git-Tag: v16.1.0~299^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F38492%2Fhead;p=ceph.git librbd/io: flush IO before shutting down image IO dispatchers Otherwise, if the dispatchers are shut down, there is a potential race where the flush can be assigned to a stuck IO and never completed. Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/io/ImageDispatcher.cc b/src/librbd/io/ImageDispatcher.cc index a9c1c985522..fa0cc77703d 100644 --- a/src/librbd/io/ImageDispatcher.cc +++ b/src/librbd/io/ImageDispatcher.cc @@ -217,11 +217,11 @@ void ImageDispatcher::shut_down(Context* on_finish) { delete async_op; on_finish->complete(0); }); - on_finish = new LambdaContext([this, async_op, on_finish](int r) { - async_op->start_op(*this->m_image_ctx); - async_op->flush(on_finish); + on_finish = new LambdaContext([this, on_finish](int r) { + Dispatcher::shut_down(on_finish); }); - Dispatcher::shut_down(on_finish); + async_op->start_op(*this->m_image_ctx); + async_op->flush(on_finish); } template