From bab16bbbebb6f12d8f3efd4fdab8e88fec2a258c Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Fri, 18 Dec 2015 13:04:20 -0500 Subject: [PATCH] librbd: stop the copyup thread during shutdown Fixes: #14107, #14108 Signed-off-by: Jason Dillaman --- src/librbd/ImageCtx.cc | 1 + src/librbd/image/CloseRequest.cc | 7 +++++++ src/librbd/image/CloseRequest.h | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index 4249ccbefb49..4da886bb70de 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -870,6 +870,7 @@ struct C_InvalidateCache : public Context { } void ImageCtx::flush_copyup(Context *on_finish) { + on_finish = util::create_async_context_callback(*this, on_finish); if (copyup_finisher == nullptr) { on_finish->complete(0); return; diff --git a/src/librbd/image/CloseRequest.cc b/src/librbd/image/CloseRequest.cc index a038dac6802a..2d7ad38343bb 100644 --- a/src/librbd/image/CloseRequest.cc +++ b/src/librbd/image/CloseRequest.cc @@ -185,6 +185,11 @@ void CloseRequest::handle_shut_down_cache(int r) { template void CloseRequest::send_flush_copyup() { + if (m_image_ctx->copyup_finisher == nullptr) { + send_flush_op_work_queue(); + return; + } + CephContext *cct = m_image_ctx->cct; ldout(cct, 10) << this << " " << __func__ << dendl; @@ -196,6 +201,8 @@ template void CloseRequest::handle_flush_copyup(int r) { CephContext *cct = m_image_ctx->cct; ldout(cct, 10) << this << " " << __func__ << ": r=" << r << dendl; + + m_image_ctx->copyup_finisher->stop(); send_flush_op_work_queue(); } diff --git a/src/librbd/image/CloseRequest.h b/src/librbd/image/CloseRequest.h index 1427181dd965..f22e2dda80b7 100644 --- a/src/librbd/image/CloseRequest.h +++ b/src/librbd/image/CloseRequest.h @@ -49,8 +49,8 @@ private: * SHUTDOWN_CACHE * | * v - * FLUSH_COPYUP - * | + * FLUSH_COPYUP (skip if copyup + * | disabled) * v * FLUSH_OP_WORK_QUEUE . . . . . * | . -- 2.47.3