dm-crypt: fix warning in shutdown path
PATCH 1/1 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.
--- drivers/md/dm-crypt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/md/dm-crypt.c +4 -4
@@ -2221,14 +2221,14 @@ 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); +if (cc->n_allocated_pages.counters) +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);
Signature · 1 line
2.17.1
Quoted 3 lines · Kent Overstreet
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.
Looks good, but needs a fixes line. I'll add one.
Signature · 1 line
Jens Axboe
Mike Snitzer
Acked-byQuoted 6 lines · Jens Axboe
Quoted 3 lines · Kent Overstreet
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.
Looks good, but needs a fixes line. I'll add one.
Also needs the subject and header updated to reflect that it fixes the crash (Krzysztof please verify):
Quoted 8 lines · Mike Snitzer
Quoted 5 lines · Jens Axboe
Quoted 3 lines · Kent Overstreet
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.
Quoted 7 lines
Quoted 1 line
Looks good, but needs a fixes line. I'll add one.
Also needs the subject and header updated to reflect that it fixes the crash (Krzysztof please verify):
Reported-by Krzysztof Kozlowski <[email protected]>Acked-by Mike Snitzer <[email protected]>
Indeed, I have added that. Thanks Mike.
Signature · 1 line
Jens Axboe
Krzysztof Kozlowski
Tested-byQuoted 11 lines · Jens Axboe
Quoted 10 lines · Mike Snitzer
Quoted 6 lines · Jens Axboe
Quoted 3 lines · Kent Overstreet
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.
Looks good, but needs a fixes line. I'll add one.
Quoted 7 lines
Quoted 5 lines
Also needs the subject and header updated to reflect that it fixes the crash (Krzysztof please verify):
Reported-by Krzysztof Kozlowski <[email protected]>Acked-by Mike Snitzer <[email protected]>Indeed, I have added that. Thanks Mike.
Thanks for adding tags!
This fixes reported issue:
Best regards,
Krzysztof