public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Asai Thambi S P <asamymuthupa@micron.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Sam Bradshaw <sbradshaw@micron.com>
Subject: block: check for dying queue in generic_make_request()
Date: Wed, 16 Apr 2014 20:31:57 -0700	[thread overview]
Message-ID: <534F4B2D.3060302@micron.com> (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.

Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
---
 block/blk-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index e45b321..cec6bf4 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -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",
-- 
1.7.1


                 reply	other threads:[~2014-04-17  3:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=534F4B2D.3060302@micron.com \
    --to=asamymuthupa@micron.com \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sbradshaw@micron.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox