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

Commit d00a11df authored by Kent Overstreet's avatar Kent Overstreet Committed by Jens Axboe
Browse files

dm-crypt: fix warning in shutdown path



The counter for the number of allocated pages includes pages in the
mempool's reserve, so checking that the number of allocated pages is 0
needs to happen after we exit the mempool.

Fixes: 6f1c819c ("dm: convert to bioset_init()/mempool_init()")
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Reported-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Acked-by: default avatarMike Snitzer <snitzer@redhat.com>

Fixed to always just use percpu_counter_sum()

Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 9cfd5a95
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -2221,14 +2221,13 @@ static void crypt_dtr(struct dm_target *ti)

	bioset_exit(&cc->bs);

	if (mempool_initialized(&cc->page_pool))
		WARN_ON(percpu_counter_sum(&cc->n_allocated_pages) != 0);
	percpu_counter_destroy(&cc->n_allocated_pages);

	mempool_exit(&cc->page_pool);
	mempool_exit(&cc->req_pool);
	mempool_exit(&cc->tag_pool);

	WARN_ON(percpu_counter_sum(&cc->n_allocated_pages) != 0);
	percpu_counter_destroy(&cc->n_allocated_pages);

	if (cc->iv_gen_ops && cc->iv_gen_ops->dtr)
		cc->iv_gen_ops->dtr(cc);