summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@suse.de>2011-05-18 16:20:10 +0200
committerWilly Tarreau <w@1wt.eu>2012-02-11 15:38:37 +0100
commit636121a6617fc1a59549b9ad665cd5f61ded5261 (patch)
tree5c76d0e9c220c281e763a909635f1e372ab7bca8
parent3870ae183ae5b0eee768fd0daa07047e751403eb (diff)
block: add proper state guards to __elv_next_request
commit 0a58e077eb600d1efd7e54ad9926a75a39d7f8ae upstream. 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. [WT: in 2.6.27, __elv_next_request() is in elevator.c] Signed-off-by: James Bottomley <James.Bottomley@suse.de> Signed-off-by: Jens Axboe <jaxboe@fusionio.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Willy Tarreau <w@1wt.eu>
-rw-r--r--block/elevator.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/elevator.c b/block/elevator.c
index ed6f8f32d27e..3e37ca822d8f 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -729,7 +729,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;
}
}