From 3d5cef38c37e5dda6b23751ad560851f1304d86d Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 12 May 2015 10:19:48 -0400 Subject: [PATCH] librbd: flush pending ops while not holding lock Signed-off-by: Jason Dillaman --- src/librbd/ImageWatcher.cc | 1 + src/librbd/internal.cc | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librbd/ImageWatcher.cc b/src/librbd/ImageWatcher.cc index 05b592f171046..a8a7c2114d881 100644 --- a/src/librbd/ImageWatcher.cc +++ b/src/librbd/ImageWatcher.cc @@ -379,6 +379,7 @@ bool ImageWatcher::release_lock() m_image_ctx.owner_lock.put_write(); m_image_ctx.cancel_async_requests(); + m_image_ctx.flush_async_operations(); m_image_ctx.owner_lock.get_write(); if (!is_lock_owner()) { diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 91620e5a68fe6..92e2b5bfe1953 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -2827,9 +2827,10 @@ reprotect_and_return_err: } ictx->aio_work_queue->drain(); - ictx->cancel_async_requests(); + ictx->flush_async_operations(); ictx->readahead.wait_for_pending(); + if (ictx->object_cacher) { ictx->shutdown_cache(); // implicitly flushes } else { -- 2.39.5