In case of IO scheduler, any request shouldn't have a tag
assigned before dispatching, so add the warning to monitor
possible bug.

Signed-off-by: Ming Lei <ming....@redhat.com>
---
 block/blk-mq-sched.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index c2ea8c2b896b..b6934a9424ff 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -271,10 +271,8 @@ static bool blk_mq_sched_bypass_insert(struct 
blk_mq_hw_ctx *hctx,
                return true;
        }
 
-       if (has_sched) {
+       if (has_sched)
                rq->rq_flags |= RQF_SORTED;
-               WARN_ON(rq->tag != -1);
-       }
 
        return false;
 }
@@ -355,6 +353,8 @@ void blk_mq_sched_insert_request(struct request *rq, bool 
at_head,
                goto run;
        }
 
+       WARN_ON(e && (rq->tag != -1));
+
        if (blk_mq_sched_bypass_insert(hctx, !!e, rq))
                goto run;
 
-- 
2.9.5

Reply via email to