projects/linux·commit d136f2ef

dm kcopyd: fix job_pool leak

d136f2ef · Alasdair G Kergon <[email protected]> · 2011-10-23 20:55:17 +01:00

Fix memory leak introduced by commit a6e50b409d3f9e0833e69c3c9cca822e8fa4adbb
(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 c6ea41fbbe08f270a8edef99dc369faf809d1bd6
(dm kcopyd: preallocate sub jobs to avoid deadlock)

Reported-by: Michael Leun <[email protected]>
Cc: Mikulas Patocka <[email protected]>
Signed-off-by: Alasdair G Kergon <[email protected]>
Commit
d136f2efdf3a4faba47f58603f8ace2207234d75
Parents
899e3ee4

Changes

1 files changed · +1 −0

FileStatusAddDelContent
drivers/md/dm-kcopyd.cmodified+1−0View file

drivers/md/dm-kcopyd.c

View file
diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c
index f821470..32ac708 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);