aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2012-05-11 20:43:12 -0400
committerAlasdair G Kergon <agk@redhat.com>2012-05-11 20:43:12 -0400
commit03aaae7cdc71bc306888440b1f569d463e917b6d (patch)
tree0f26df484419ac7cfc73b0d13f94a4cf7b701781 /drivers
parentd48b97b403d23f6df0b990cee652bdf9a52337a3 (diff)
dm thin: reinstate missing mempool_free in cell_release_singleton
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/dm-thin.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 213ae32a0fc4..301db0f45d3b 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -279,8 +279,10 @@ static void __cell_release(struct cell *cell, struct bio_list *inmates)
279 279
280 hlist_del(&cell->list); 280 hlist_del(&cell->list);
281 281
282 bio_list_add(inmates, cell->holder); 282 if (inmates) {
283 bio_list_merge(inmates, &cell->bios); 283 bio_list_add(inmates, cell->holder);
284 bio_list_merge(inmates, &cell->bios);
285 }
284 286
285 mempool_free(cell, prison->cell_pool); 287 mempool_free(cell, prison->cell_pool);
286} 288}
@@ -303,9 +305,10 @@ static void cell_release(struct cell *cell, struct bio_list *bios)
303 */ 305 */
304static void __cell_release_singleton(struct cell *cell, struct bio *bio) 306static void __cell_release_singleton(struct cell *cell, struct bio *bio)
305{ 307{
306 hlist_del(&cell->list);
307 BUG_ON(cell->holder != bio); 308 BUG_ON(cell->holder != bio);
308 BUG_ON(!bio_list_empty(&cell->bios)); 309 BUG_ON(!bio_list_empty(&cell->bios));
310
311 __cell_release(cell, NULL);
309} 312}
310 313
311static void cell_release_singleton(struct cell *cell, struct bio *bio) 314static void cell_release_singleton(struct cell *cell, struct bio *bio)