]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: leak on canceling simple io scheduler timer task 27755/head
authorMykola Golub <mgolub@suse.com>
Wed, 24 Apr 2019 14:08:48 +0000 (15:08 +0100)
committerMykola Golub <mgolub@suse.com>
Wed, 24 Apr 2019 14:44:57 +0000 (15:44 +0100)
When the timer task is canceled it is just deleted and the passed
context will not be executed.

Signed-off-by: Mykola Golub <mgolub@suse.com>
src/librbd/io/SimpleSchedulerObjectDispatch.cc

index 21f8fe5f5cf0145c1ca381e332729a14e8d7902e..49dd68483a383b51cc682dfc1a2d13a0a558e011 100644 (file)
@@ -499,20 +499,19 @@ void SimpleSchedulerObjectDispatch<I>::schedule_dispatch_delayed_requests() {
     object_requests = m_dispatch_queue.front().get();
   }
 
-  auto ctx = new FunctionContext(
-    [this, object_no=object_requests->get_object_no()](int r) {
-      Mutex::Locker locker(m_lock);
-      dispatch_delayed_requests(object_no);
-    });
-
   m_timer_task = new FunctionContext(
-    [this, ctx](int r) {
+    [this, object_no=object_requests->get_object_no()](int r) {
       ceph_assert(m_timer_lock->is_locked());
       auto cct = m_image_ctx->cct;
       ldout(cct, 20) << "running timer task " << m_timer_task << dendl;
 
       m_timer_task = nullptr;
-      m_image_ctx->op_work_queue->queue(ctx, 0);
+      m_image_ctx->op_work_queue->queue(
+          new FunctionContext(
+            [this, object_no](int r) {
+              Mutex::Locker locker(m_lock);
+              dispatch_delayed_requests(object_no);
+            }), 0);
     });
 
   ldout(cct, 20) << "scheduling task " << m_timer_task << " at "