Skip to contentSkip to conversation

block: check for dying queue in generic_make_request()

PATCH Asai Thambi S P 1 participant 1 message Apr 17, 2014 Block layer

lore
Share & tools
lore
#0 lore raw

Check for dying queue is in request queue interface, but not for direct use of make_request().

When a mounted device is surprise removed, block drivers delete gendisk and cleanup request queue. As the reference count is non-zero, these structures continue to exist and any further I/O request is passed on to block drivers. With respect to the block driver, the device is removed and cleaned up the data structures. This check will stop I/O to a non-existent device at the block layer.

---
 block/blk-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
block/blk-core.c +1 -1
index e45b321..cec6bf4 100644
@@ -1713,7 +1713,7 @@ generic_make_request_checks(struct bio *bio)
 		goto end_io;
 
 	q = bdev_get_queue(bio->bi_bdev);
-	if (unlikely(!q)) {
+	if (unlikely(!q || blk_queue_dying(q))) {
 		printk(KERN_ERR
 		       "generic_make_request: Trying to access "
 			"nonexistent block-device %s (%Lu)\n",
Signature · 1 line
1.7.1