From: Jason Dillaman Date: Wed, 23 Dec 2015 17:06:50 +0000 (-0500) Subject: librbd: ensure librados callbacks are flushed prior to destroying image X-Git-Tag: v9.2.1~1^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b0c91768d4ac81baaf9b5edec92adad91ade9b64;p=ceph.git librbd: ensure librados callbacks are flushed prior to destroying image Fixes: #14092 Signed-off-by: Jason Dillaman (cherry picked from commit 98157ab3274bd960e4487e34f5a83e9c921a6ac8) --- diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index d04b0970059e..d50a528f983b 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -208,6 +208,11 @@ void _flush_async_operations(ImageCtx *ictx, Context *on_finish) { } delete[] format_string; + md_ctx.aio_flush(); + data_ctx.aio_flush(); + op_work_queue->drain(); + aio_work_queue->drain(); + delete op_work_queue; delete aio_work_queue; } diff --git a/src/test/librbd/mock/MockImageCtx.h b/src/test/librbd/mock/MockImageCtx.h index 53d6fd0d01e1..8af8f5d32d7a 100644 --- a/src/test/librbd/mock/MockImageCtx.h +++ b/src/test/librbd/mock/MockImageCtx.h @@ -47,6 +47,9 @@ struct MockImageCtx { } ~MockImageCtx() { + image_ctx->md_ctx.aio_flush(); + image_ctx->data_ctx.aio_flush(); + image_ctx->op_work_queue->drain(); delete image_watcher; delete op_work_queue; delete aio_work_queue;