From 96b0db5decfad452964750cff92a63007433e519 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Mon, 27 Apr 2015 03:42:24 -0400 Subject: [PATCH] librbd: update ref count when queueing AioCompletion If the client releases the AioCompletion while librbd is waiting to acquire the exclusive lock, the memory associated with the completion will be freed too early. Fixes: #11478 Backport: hammer Signed-off-by: Jason Dillaman (cherry picked from commit fd7723a1e62e682ac5a5279231a9fd6f5682bf94) --- src/librbd/ImageWatcher.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/librbd/ImageWatcher.cc b/src/librbd/ImageWatcher.cc index b5f7f60f27006..486f541fbe0fa 100644 --- a/src/librbd/ImageWatcher.cc +++ b/src/librbd/ImageWatcher.cc @@ -188,6 +188,8 @@ int ImageWatcher::request_lock( bool request_pending = !m_aio_requests.empty(); ldout(m_image_ctx.cct, 15) << "queuing aio request: " << c << dendl; + + c->get(); m_aio_requests.push_back(std::make_pair(restart_op, c)); if (request_pending) { return 0; @@ -534,6 +536,7 @@ void ImageWatcher::retry_aio_requests() { ldout(m_image_ctx.cct, 20) << "retrying aio request: " << iter->second << dendl; iter->first(iter->second); + iter->second->put(); } } -- 2.39.5