diff options
author | Mykola Golub <mgolub@suse.com> | 2019-04-24 16:08:48 +0200 |
---|---|---|
committer | Mykola Golub <mgolub@suse.com> | 2019-04-24 16:44:57 +0200 |
commit | 32a3b85a0c7c51e8aca2f03c33f400dbab46e63e (patch) | |
tree | 61077c26358cf13e65612bc851c3197171769a7f /src/librbd | |
parent | Merge pull request #27221 from LenzGr/update-backportscripts (diff) | |
download | ceph-32a3b85a0c7c51e8aca2f03c33f400dbab46e63e.tar.xz ceph-32a3b85a0c7c51e8aca2f03c33f400dbab46e63e.zip |
librbd: leak on canceling simple io scheduler timer task
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>
Diffstat (limited to 'src/librbd')
-rw-r--r-- | src/librbd/io/SimpleSchedulerObjectDispatch.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/librbd/io/SimpleSchedulerObjectDispatch.cc b/src/librbd/io/SimpleSchedulerObjectDispatch.cc index 21f8fe5f5cf..49dd68483a3 100644 --- a/src/librbd/io/SimpleSchedulerObjectDispatch.cc +++ b/src/librbd/io/SimpleSchedulerObjectDispatch.cc @@ -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 " |