From 246802f91514edeb19eff04a6dbeaf778eedf1be Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 29 Jul 2020 07:30:28 -0400 Subject: [PATCH] librbd: potentially delay completion of image dispatcher spec If an AioCompletion is being completed for an external API user, ensure that the completion of image dispatcher finalizer does not race with the potential to close the image. Signed-off-by: Jason Dillaman --- src/librbd/io/AioCompletion.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librbd/io/AioCompletion.cc b/src/librbd/io/AioCompletion.cc index f6015b8a942d..cd5df0e7147e 100644 --- a/src/librbd/io/AioCompletion.cc +++ b/src/librbd/io/AioCompletion.cc @@ -114,10 +114,6 @@ void AioCompletion::complete() { notify_callbacks_complete(); } - if (image_dispatcher_ctx != nullptr) { - image_dispatcher_ctx->complete(rval); - } - tracepoint(librbd, aio_complete_exit); } @@ -275,6 +271,10 @@ void AioCompletion::notify_callbacks_complete() { cond.notify_all(); } + if (image_dispatcher_ctx != nullptr) { + image_dispatcher_ctx->complete(rval); + } + // note: possible for image to be closed after op marked finished if (async_op.started()) { async_op.finish_op(); -- 2.47.3