From: Jason Dillaman Date: Mon, 27 Apr 2015 07:42:24 +0000 (-0400) Subject: librbd: update ref count when queueing AioCompletion X-Git-Tag: v9.0.0~3^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fd7723a1e62e682ac5a5279231a9fd6f5682bf94;p=ceph.git 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 --- diff --git a/src/librbd/ImageWatcher.cc b/src/librbd/ImageWatcher.cc index 218f1a394e46..26499c65019e 100644 --- a/src/librbd/ImageWatcher.cc +++ b/src/librbd/ImageWatcher.cc @@ -186,6 +186,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; @@ -532,6 +534,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(); } }