[xenial:linux-azure][PATCH 14/15] blk-mq: fail the request in case issue failure

Marcelo Henrique Cerri marcelo.cerri at canonical.com
Wed Nov 27 20:18:19 UTC 2019


From: Ming Lei <ming.lei at redhat.com>

BugLink: https://bugs.launchpad.net/bugs/1848739

Inside blk_mq_try_issue_list_directly(), if the request is issued as
failed, we shouldn't try to do it again, otherwise the warning in
blk_mq_start_request() will be triggered. This change is aligned to
behaviour of other ways of request issue & dispatch.

Fixes: 6ce3dd6eec1 ("blk-mq: issue directly if hw queue isn't busy in case of 'none'")
Cc: Kashyap Desai <kashyap.desai at broadcom.com>
Cc: Laurence Oberman <loberman at redhat.com>
Cc: Omar Sandoval <osandov at fb.com>
Cc: Christoph Hellwig <hch at lst.de>
Cc: Bart Van Assche <bart.vanassche at wdc.com>
Cc: Hannes Reinecke <hare at suse.de>
Cc: Kashyap Desai <kashyap.desai at broadcom.com>
Cc: kernel test robot <rong.a.chen at intel.com>
Cc: LKP <lkp at 01.org>
Reported-by: kernel test robot <rong.a.chen at intel.com>
Signed-off-by: Ming Lei <ming.lei at redhat.com>
Signed-off-by: Jens Axboe <axboe at kernel.dk>
(cherry picked from commit 8824f62246bef288173a6624a363352f0d4d3b09)
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri at canonical.com>
---
 block/blk-mq.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index f539357f5d3b..6a1b7e3af232 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1895,8 +1895,12 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
 		list_del_init(&rq->queuelist);
 		ret = blk_mq_request_issue_directly(rq);
 		if (ret != BLK_STS_OK) {
-			list_add(&rq->queuelist, list);
-			break;
+			if (ret == BLK_STS_RESOURCE ||
+					ret == BLK_STS_DEV_RESOURCE) {
+				list_add(&rq->queuelist, list);
+				break;
+			}
+			blk_mq_end_request(rq, ret);
 		}
 	}
 }
-- 
2.20.1




More information about the kernel-team mailing list