diff options
author | Mike Snitzer <snitzer@redhat.com> | 2012-05-12 01:43:12 +0100 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2012-07-04 05:44:17 +0100 |
commit | c2ddd0a4c322e21255b630573b4eec0d9dd2297b (patch) | |
tree | c13e19309c47908c15e0ca9b07a76f74c0b88e72 /drivers/md | |
parent | 6fd8c58dd9675aa0f984c9a1c604a4a8d9ca4c3b (diff) |
dm thin: reinstate missing mempool_free in cell_release_singleton
commit 03aaae7cdc71bc306888440b1f569d463e917b6d upstream.
Fix a significant memory leak inadvertently introduced during
simplification of cell_release_singleton() in commit
6f94a4c45a6f744383f9f695dde019998db3df55 ("dm thin: fix stacked bi_next
usage").
A cell's hlist_del() must be accompanied by a mempool_free().
Use __cell_release() to do this, like before.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-thin.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index da2f0217df66..532a9029c2ae 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -288,8 +288,10 @@ static void __cell_release(struct cell *cell, struct bio_list *inmates) hlist_del(&cell->list); - bio_list_add(inmates, cell->holder); - bio_list_merge(inmates, &cell->bios); + if (inmates) { + bio_list_add(inmates, cell->holder); + bio_list_merge(inmates, &cell->bios); + } mempool_free(cell, prison->cell_pool); } @@ -312,9 +314,10 @@ static void cell_release(struct cell *cell, struct bio_list *bios) */ static void __cell_release_singleton(struct cell *cell, struct bio *bio) { - hlist_del(&cell->list); BUG_ON(cell->holder != bio); BUG_ON(!bio_list_empty(&cell->bios)); + + __cell_release(cell, NULL); } static void cell_release_singleton(struct cell *cell, struct bio *bio) |