[PATCH] block: avoid incorrect bdi_unregiter call in blk_cleanup_queue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux