From: Jason Dillaman Date: Mon, 27 Apr 2015 07:42:24 +0000 (-0400) Subject: librbd: update ref count when queueing AioCompletion X-Git-Tag: v0.94.2~16^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=96b0db5decfad452964750cff92a63007433e519;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 (cherry picked from commit fd7723a1e62e682ac5a5279231a9fd6f5682bf94) --- diff --git a/src/librbd/ImageWatcher.cc b/src/librbd/ImageWatcher.cc index b5f7f60f2700..486f541fbe0f 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(); } }