Commit 95febeb6 authored by Jens Axboe's avatar Jens Axboe

block: fix missing queue put in error path

If we fail the submission queue checks, we don't put the queue afterwards.
This can cause various issues like stalls on scheduler switch or failure
to remove the device, or like in the original bug report, timeout waiting
for the device on reboot/restart.

While in there, fix a few whitespace discrepancies in the surrounding
code.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=215039
Fixes: b637108a ("blk-mq: fix filesystem I/O request allocation")
Reported-and-tested-by: default avatarStephen Smith <stephenmsmith@blueyonder.co.uk>
Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 94c4b4fd
...@@ -2543,8 +2543,7 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q, ...@@ -2543,8 +2543,7 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
return NULL; return NULL;
} }
static inline bool blk_mq_can_use_cached_rq(struct request *rq, static inline bool blk_mq_can_use_cached_rq(struct request *rq, struct bio *bio)
struct bio *bio)
{ {
if (blk_mq_get_hctx_type(bio->bi_opf) != rq->mq_hctx->type) if (blk_mq_get_hctx_type(bio->bi_opf) != rq->mq_hctx->type)
return false; return false;
...@@ -2565,7 +2564,6 @@ static inline struct request *blk_mq_get_request(struct request_queue *q, ...@@ -2565,7 +2564,6 @@ static inline struct request *blk_mq_get_request(struct request_queue *q,
bool checked = false; bool checked = false;
if (plug) { if (plug) {
rq = rq_list_peek(&plug->cached_rq); rq = rq_list_peek(&plug->cached_rq);
if (rq && rq->q == q) { if (rq && rq->q == q) {
if (unlikely(!submit_bio_checks(bio))) if (unlikely(!submit_bio_checks(bio)))
...@@ -2587,12 +2585,14 @@ static inline struct request *blk_mq_get_request(struct request_queue *q, ...@@ -2587,12 +2585,14 @@ static inline struct request *blk_mq_get_request(struct request_queue *q,
fallback: fallback:
if (unlikely(bio_queue_enter(bio))) if (unlikely(bio_queue_enter(bio)))
return NULL; return NULL;
if (!checked && !submit_bio_checks(bio)) if (unlikely(!checked && !submit_bio_checks(bio)))
return NULL; goto out_put;
rq = blk_mq_get_new_requests(q, plug, bio, nsegs, same_queue_rq); rq = blk_mq_get_new_requests(q, plug, bio, nsegs, same_queue_rq);
if (!rq) if (rq)
blk_queue_exit(q); return rq;
return rq; out_put:
blk_queue_exit(q);
return NULL;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment