]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: update ref count when queueing AioCompletion
authorJason Dillaman <dillaman@redhat.com>
Mon, 27 Apr 2015 07:42:24 +0000 (03:42 -0400)
committerLoic Dachary <ldachary@redhat.com>
Wed, 6 May 2015 09:48:39 +0000 (11:48 +0200)
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 <dillaman@redhat.com>
(cherry picked from commit fd7723a1e62e682ac5a5279231a9fd6f5682bf94)

src/librbd/ImageWatcher.cc

index b5f7f60f27006c835f393da754e960bdf8e1650f..486f541fbe0fa584e16cc54449cd1bbee22172d6 100644 (file)
@@ -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();
   }
 }