From 98157ab3274bd960e4487e34f5a83e9c921a6ac8 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 23 Dec 2015 12:06:50 -0500 Subject: [PATCH] librbd: ensure librados callbacks are flushed prior to destroying image Fixes: #14092 Signed-off-by: Jason Dillaman --- src/librbd/ImageCtx.cc | 2 ++ src/test/librbd/mock/MockImageCtx.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index 4da886bb70de6..6f33962aa413a 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -212,6 +212,8 @@ struct C_InvalidateCache : public Context { } delete[] format_string; + md_ctx.aio_flush(); + data_ctx.aio_flush(); op_work_queue->drain(); aio_work_queue->drain(); diff --git a/src/test/librbd/mock/MockImageCtx.h b/src/test/librbd/mock/MockImageCtx.h index 7368a52a23aa9..c19692094e3d2 100644 --- a/src/test/librbd/mock/MockImageCtx.h +++ b/src/test/librbd/mock/MockImageCtx.h @@ -57,6 +57,8 @@ struct MockImageCtx { ~MockImageCtx() { wait_for_async_requests(); + 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; -- 2.39.5