blk-mq: fix blk_mq_tagset_busy_iter
authorMing Lei <[email protected]>
Thu, 2 Aug 2018 17:49:37 +0000 (01:49 +0800)
committerJens Axboe <[email protected]>
Thu, 2 Aug 2018 20:47:20 +0000 (14:47 -0600)
Commit d250bf4e776ff09d5("blk-mq: only iterate over inflight requests
in blk_mq_tagset_busy_iter") uses 'blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT'
to replace 'blk_mq_request_started(req)', this way is wrong, and causes
lots of test system hang during booting.

Fix the issue by using blk_mq_request_started(req) inside bt_tags_iter().

Fixes: d250bf4e776ff09d5 ("blk-mq: only iterate over inflight requests in blk_mq_tagset_busy_iter")
Cc: Josef Bacik <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Matt Hart <[email protected]>
Cc: Johannes Thumshirn <[email protected]>
Cc: John Garry <[email protected]>
Cc: Hannes Reinecke <[email protected]>,
Cc: "Martin K. Petersen" <[email protected]>,
Cc: James Bottomley <[email protected]>
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Bart Van Assche <[email protected]>
Tested-by: Guenter Roeck <[email protected]>
Reported-by: Mark Brown <[email protected]>
Reported-by: Guenter Roeck <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
block/blk-mq-tag.c

index 09b2ee6694fb16858a104b7021b986aff603a91a..3de0836163c2c5c4800677878a2116738fb43a9c 100644 (file)
@@ -271,7 +271,7 @@ static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data)
         * test and set the bit before assining ->rqs[].
         */
        rq = tags->rqs[bitnr];
-       if (rq && blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT)
+       if (rq && blk_mq_request_started(rq))
                iter_data->fn(rq, iter_data->data, reserved);
 
        return true;