Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03aaae7c authored by Mike Snitzer's avatar Mike Snitzer Committed by Alasdair G Kergon
Browse files

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
6f94a4c4 ("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: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent d48b97b4
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -279,8 +279,10 @@ static void __cell_release(struct cell *cell, struct bio_list *inmates)

	hlist_del(&cell->list);

	if (inmates) {
		bio_list_add(inmates, cell->holder);
		bio_list_merge(inmates, &cell->bios);
	}

	mempool_free(cell, prison->cell_pool);
}
@@ -303,9 +305,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)