Skip to content

Commit

Permalink
dm kcopyd: fix job_pool leak
Browse files Browse the repository at this point in the history
Fix memory leak introduced by commit a6e50b4
(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 c6ea41f
(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]>
  • Loading branch information
kergon committed Oct 23, 2011
1 parent 899e3ee commit d136f2e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/md/dm-kcopyd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit d136f2e

Please sign in to comment.