]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd/io: flush IO before shutting down image IO dispatchers 38492/head
authorJason Dillaman <dillaman@redhat.com>
Tue, 8 Dec 2020 14:58:07 +0000 (09:58 -0500)
committerJason Dillaman <dillaman@redhat.com>
Tue, 8 Dec 2020 15:01:48 +0000 (10:01 -0500)
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 <dillaman@redhat.com>
src/librbd/io/ImageDispatcher.cc

index a9c1c985522decf4670cc0e9765f1bda7612ab5d..fa0cc77703d65ed54698f768f7124289e6e19ec4 100644 (file)
@@ -217,11 +217,11 @@ void ImageDispatcher<I>::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<I, ImageDispatcherInterface>::shut_down(on_finish);
     });
-  Dispatcher<I, ImageDispatcherInterface>::shut_down(on_finish);
+  async_op->start_op(*this->m_image_ctx);
+  async_op->flush(on_finish);
 }
 
 template <typename I>