[PATCH 3/3 Xenial SRU] blk-mq: End unstarted requests on dying queue

Tim Gardner tim.gardner at canonical.com
Wed May 25 14:47:33 UTC 2016


From: Keith Busch <keith.busch at intel.com>

BugLink: http://bugs.launchpad.net/bugs/1581034

Go directly to ending a request if it wasn't started. Previously, completing a
request may invoke a driver callback for a request it didn't initialize.

Signed-off-by: Keith Busch <keith.busch at intel.com>
Reviewed-by: Sagi Grimberg <sagig at mellanox.com>
Reviewed-by: Johannes Thumshirn <jthumshirn at suse.de>
Acked-by: Christoph Hellwig <hch at lst.de>
Signed-off-by: Jens Axboe <axboe at fb.com>
(back ported from commit a59e0f5795fe52dad42a99c00287e3766153b312)
Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
---
 block/blk-mq.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 93a4e19..3989b2d 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -599,8 +599,10 @@ static void blk_mq_check_expired(struct blk_mq_hw_ctx *hctx,
 		 * If a request wasn't started before the queue was
 		 * marked dying, kill it here or it'll go unnoticed.
 		 */
-		if (unlikely(blk_queue_dying(rq->q)))
-			blk_mq_complete_request(rq, -EIO);
+		if (unlikely(blk_queue_dying(rq->q))) {
+			rq->errors = -EIO;
+			blk_mq_complete_request(rq, rq->errors);
+		}
 		return;
 	}
 	if (rq->cmd_flags & REQ_NO_TIMEOUT)
-- 
1.9.1





More information about the kernel-team mailing list