block-mq: don't re-queue if we get a queue error
authorJosef Bacik <josef@toxicpanda.com>
Tue, 28 Mar 2017 20:37:52 +0000 (16:37 -0400)
committerJens Axboe <axboe@fb.com>
Wed, 29 Mar 2017 19:18:18 +0000 (13:18 -0600)
When try to issue a request directly and we fail we will requeue the
request, but call blk_mq_end_request() as well.  This leads to the
completed request being on a queuelist and getting ended twice, which
causes list corruption in schedulers and other shenanigans.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Ming Lei <tom.leiming@gmail.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq.c

index f79775fc6d1b61e3b816d00e92745b7988d8b62c..5a4a2361053ebe5d5ca8efa1fb94a0f34ce63eed 100644 (file)
@@ -1475,8 +1475,6 @@ static void __blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie,
                return;
        }
 
-       __blk_mq_requeue_request(rq);
-
        if (ret == BLK_MQ_RQ_QUEUE_ERROR) {
                *cookie = BLK_QC_T_NONE;
                rq->errors = -EIO;
@@ -1484,6 +1482,7 @@ static void __blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie,
                return;
        }
 
+       __blk_mq_requeue_request(rq);
 insert:
        blk_mq_sched_insert_request(rq, false, true, false, may_sleep);
 }