public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@suse.de>
To: linux-scsi <linux-scsi@vger.kernel.org>
Cc: Jens Axboe <jaxboe@fusionio.com>
Subject: [PATCH 1/2] block: add proper state guards to __elv_next_request
Date: Fri, 22 Apr 2011 10:38:51 -0500	[thread overview]
Message-ID: <1303486731.2590.23.camel@mulgrave.site> (raw)
In-Reply-To: <1303486638.2590.21.camel@mulgrave.site>

blk_cleanup_queue() calls elevator_exit() and after this, we can't
touch the elevator without oopsing.  __elv_next_request() must check
for this state because in the refcounted queue model, we can still
call it after blk_cleanup_queue() has been called.

This was reported as causing an oops attributable to scsi.

Signed-off-by: James Bottomley <James.Bottomley@suse.de>
---
 block/blk.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/block/blk.h b/block/blk.h
index 6126346..4df474d 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -62,7 +62,8 @@ static inline struct request *__elv_next_request(struct request_queue *q)
 			return rq;
 		}
 
-		if (!q->elevator->ops->elevator_dispatch_fn(q, 0))
+		if (test_bit(QUEUE_FLAG_DEAD, &q->queue_flags) ||
+		    !q->elevator->ops->elevator_dispatch_fn(q, 0))
 			return NULL;
 	}
 }
-- 
1.7.4.1




  reply	other threads:[~2011-04-22 15:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-22 15:37 [PATCH 0/2] fix race conditions in SCSI/Block leading to oops James Bottomley
2011-04-22 15:38 ` James Bottomley [this message]
2011-04-22 15:39 ` [PATCH 2/2] put stricter guards on queue dead checks James Bottomley

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=1303486731.2590.23.camel@mulgrave.site \
    --to=james.bottomley@suse.de \
    --cc=jaxboe@fusionio.com \
    --cc=linux-scsi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox