All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: avoid incorrect bdi_unregiter call in blk_cleanup_queue
@ 2016-12-01  8:45 Masayoshi Mizuma
  2016-12-01 15:04 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Masayoshi Mizuma @ 2016-12-01  8:45 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block

blk_cleanup_queue() should call bdi_unregister() only if WB_registered
is set to bdi->wb.state. Because, blk_cleanup_queue() may be called
before bdi_register() is called, for example, error path.

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
---
 block/blk-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 14d7c07..c1ab17e 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -595,7 +595,8 @@ void blk_cleanup_queue(struct request_queue *q)
 		q->queue_lock = &q->__queue_lock;
 	spin_unlock_irq(lock);
 
-	bdi_unregister(&q->backing_dev_info);
+	if (test_bit(WB_registered, &q->backing_dev_info.wb.state))
+		bdi_unregister(&q->backing_dev_info);
 
 	/* @q is and will stay empty, shutdown and put */
 	blk_put_queue(q);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] block: avoid incorrect bdi_unregiter call in blk_cleanup_queue
  2016-12-01  8:45 [PATCH] block: avoid incorrect bdi_unregiter call in blk_cleanup_queue Masayoshi Mizuma
@ 2016-12-01 15:04 ` Jens Axboe
  2016-12-02  0:37   ` Masayoshi Mizuma
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2016-12-01 15:04 UTC (permalink / raw)
  To: Masayoshi Mizuma; +Cc: linux-block

On 12/01/2016 01:45 AM, Masayoshi Mizuma wrote:
> blk_cleanup_queue() should call bdi_unregister() only if WB_registered
> is set to bdi->wb.state. Because, blk_cleanup_queue() may be called
> before bdi_register() is called, for example, error path.

Should this logic be in bdi_unregister() instead?

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] block: avoid incorrect bdi_unregiter call in blk_cleanup_queue
  2016-12-01 15:04 ` Jens Axboe
@ 2016-12-02  0:37   ` Masayoshi Mizuma
  0 siblings, 0 replies; 3+ messages in thread
From: Masayoshi Mizuma @ 2016-12-02  0:37 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block

Hi Jens,

On Thu, 1 Dec 2016 08:04:33 -0700 Jens Axboe wrote:
> On 12/01/2016 01:45 AM, Masayoshi Mizuma wrote:
>> blk_cleanup_queue() should call bdi_unregister() only if WB_registered
>> is set to bdi->wb.state. Because, blk_cleanup_queue() may be called
>> before bdi_register() is called, for example, error path.
> 
> Should this logic be in bdi_unregister() instead?

Thank you for pointed it out! I think your suggestion is better.
I will rewrite the patch.

- Masayoshi Mizuma

> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-02  0:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-01  8:45 [PATCH] block: avoid incorrect bdi_unregiter call in blk_cleanup_queue Masayoshi Mizuma
2016-12-01 15:04 ` Jens Axboe
2016-12-02  0:37   ` Masayoshi Mizuma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.