From 3d5318fb9fed41c96a5e713f16aee88810866326 Mon Sep 17 00:00:00 2001 From: Alasdair G Kergon Date: Sun, 23 Oct 2011 20:55:17 +0100 Subject: [PATCH] dm kcopyd: fix job_pool leak Fix memory leak introduced by commit eba19b00f8ffee52e74d6008bc02d3166e5b701b (dm snapshot: skip reading origin when overwriting complete chunk). When allocating a set of jobs from kc->job_pool, job->master_job must be set (to point to itself) so that the mempool item gets freed when the master_job completes. master_job was introduced by commit 35379879309437eb33665d08962d9b3daa4b0b10 (dm kcopyd: preallocate sub jobs to avoid deadlock) Reported-by: Michael Leun Cc: Mikulas Patocka Signed-off-by: Alasdair G Kergon --- drivers/md/dm-kcopyd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c index f82147029636d..32ac70861d66c 100644 --- a/drivers/md/dm-kcopyd.c +++ b/drivers/md/dm-kcopyd.c @@ -628,6 +628,7 @@ void *dm_kcopyd_prepare_callback(struct dm_kcopyd_client *kc, job->kc = kc; job->fn = fn; job->context = context; + job->master_job = job; atomic_inc(&kc->nr_jobs); -- 2.39.5