summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2018-06-02 13:45:04 -0400
committerJens Axboe <axboe@kernel.dk>2018-06-02 20:35:00 -0600
commitd00a11df691466772435ec02471292eae07885e5 (patch)
treedbb0648d1885936d8490f910612ccc4c9186ca88 /drivers/md
parent9cfd5a95381e960bdbc5cd24ec7987205a3a9bee (diff)
downloadlinux-stable-d00a11df691466772435ec02471292eae07885e5.tar.gz
linux-stable-d00a11df691466772435ec02471292eae07885e5.tar.bz2
linux-stable-d00a11df691466772435ec02471292eae07885e5.zip
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: 6f1c819c219f ("dm: convert to bioset_init()/mempool_init()") Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Reported-by: Krzysztof Kozlowski <krzk@kernel.org> Acked-by: Mike Snitzer <snitzer@redhat.com> Fixed to always just use percpu_counter_sum() Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-crypt.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index eaf6b279accb..da02f4d8e4b9 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -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);