* [PATCH] dm-crypt: fix warning in shutdown path
@ 2018-06-02 17:45 Kent Overstreet
2018-06-02 20:03 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Kent Overstreet @ 2018-06-02 17:45 UTC (permalink / raw)
To: axboe, dm-devel, linux-kernel, snitzer; +Cc: 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.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
---
drivers/md/dm-crypt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index eaf6b279ac..9a000aa955 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -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);
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] dm-crypt: fix warning in shutdown path
2018-06-02 17:45 [PATCH] dm-crypt: fix warning in shutdown path Kent Overstreet
@ 2018-06-02 20:03 ` Jens Axboe
2018-06-02 20:07 ` Mike Snitzer
0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2018-06-02 20:03 UTC (permalink / raw)
To: Kent Overstreet, dm-devel, linux-kernel, snitzer
On 6/2/18 11:45 AM, Kent Overstreet wrote:
> 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.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: dm-crypt: fix warning in shutdown path
2018-06-02 20:03 ` Jens Axboe
@ 2018-06-02 20:07 ` Mike Snitzer
2018-06-02 20:10 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Mike Snitzer @ 2018-06-02 20:07 UTC (permalink / raw)
To: Jens Axboe, Krzysztof Kozlowski; +Cc: Kent Overstreet, dm-devel, linux-kernel
On Sat, Jun 02 2018 at 4:03pm -0400,
Jens Axboe <axboe@kernel.dk> wrote:
> On 6/2/18 11:45 AM, Kent Overstreet wrote:
> > 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):
Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Mike Snitzer <snitzer@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: dm-crypt: fix warning in shutdown path
2018-06-02 20:07 ` Mike Snitzer
@ 2018-06-02 20:10 ` Jens Axboe
2018-06-04 9:31 ` Krzysztof Kozlowski
0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2018-06-02 20:10 UTC (permalink / raw)
To: Mike Snitzer, Krzysztof Kozlowski; +Cc: Kent Overstreet, dm-devel, linux-kernel
On 6/2/18 2:07 PM, Mike Snitzer wrote:
> On Sat, Jun 02 2018 at 4:03pm -0400,
> Jens Axboe <axboe@kernel.dk> wrote:
>
>> On 6/2/18 11:45 AM, Kent Overstreet wrote:
>>> 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):
>
> Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
> Acked-by: Mike Snitzer <snitzer@redhat.com>
Indeed, I have added that. Thanks Mike.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: dm-crypt: fix warning in shutdown path
2018-06-02 20:10 ` Jens Axboe
@ 2018-06-04 9:31 ` Krzysztof Kozlowski
0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2018-06-04 9:31 UTC (permalink / raw)
To: Jens Axboe; +Cc: Mike Snitzer, Kent Overstreet, dm-devel, linux-kernel
On Sat, Jun 2, 2018 at 10:10 PM, Jens Axboe <axboe@kernel.dk> wrote:
> On 6/2/18 2:07 PM, Mike Snitzer wrote:
>> On Sat, Jun 02 2018 at 4:03pm -0400,
>> Jens Axboe <axboe@kernel.dk> wrote:
>>
>>> On 6/2/18 11:45 AM, Kent Overstreet wrote:
>>>> 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):
>>
>> Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
>> Acked-by: Mike Snitzer <snitzer@redhat.com>
>
> Indeed, I have added that. Thanks Mike.
Thanks for adding tags!
This fixes reported issue:
Tested-by: Krzysztof Kozlowski <krzk@kernel.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-06-04 9:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-02 17:45 [PATCH] dm-crypt: fix warning in shutdown path Kent Overstreet
2018-06-02 20:03 ` Jens Axboe
2018-06-02 20:07 ` Mike Snitzer
2018-06-02 20:10 ` Jens Axboe
2018-06-04 9:31 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).