]> git-server-git.apps.pok.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)
committerJason Dillaman <dillaman@redhat.com>
Mon, 27 Apr 2015 07:42:24 +0000 (03:42 -0400)
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>
src/librbd/ImageWatcher.cc

index 218f1a394e467c08e97a89cd273fd095d833d368..26499c65019eb18a18ce805693b65bbccd10971c 100644 (file)
@@ -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();
   }
 }