From: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: <linux-block@vger.kernel.org>
Subject: [PATCH] block: avoid incorrect bdi_unregiter call in blk_cleanup_queue
Date: Thu, 1 Dec 2016 17:45:04 +0900 [thread overview]
Message-ID: <583FE310.7040607@jp.fujitsu.com> (raw)
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
next reply other threads:[~2016-12-01 8:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-01 8:45 Masayoshi Mizuma [this message]
2016-12-01 15:04 ` [PATCH] block: avoid incorrect bdi_unregiter call in blk_cleanup_queue Jens Axboe
2016-12-02 0:37 ` Masayoshi Mizuma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=583FE310.7040607@jp.fujitsu.com \
--to=m.mizuma@jp.fujitsu.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.