From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Ming Lei To: Jens Axboe , linux-block@vger.kernel.org Cc: Tejun Heo , Bart Van Assche , Martin Steigerwald , Israel Rukshin , Ming Lei , "jianchao.wang" , Christoph Hellwig , Sagi Grimberg , Max Gurtovoy Subject: [PATCH V4 1/2] blk-mq: set RQF_MQ_TIMEOUT_EXPIRED when the rq's timeout isn't handled Date: Sun, 15 Apr 2018 23:43:56 +0800 Message-Id: <20180415154357.19788-2-ming.lei@redhat.com> In-Reply-To: <20180415154357.19788-1-ming.lei@redhat.com> References: <20180415154357.19788-1-ming.lei@redhat.com> List-ID: Firstly blk_mq_timeout_work() is always run exclusivley for each queue. Secondly if .timeout() returns BLK_EH_RESET_TIMER or BLK_EH_HANDLED, the flag of RQF_MQ_TIMEOUT_EXPIRED will be cleared for this request, because the request will be requeued or freed for BLK_EH_HANDLED, and for BLK_EH_RESET_TIMER, new timer has to be started for this req. So this patch only sets the flag of RQF_MQ_TIMEOUT_EXPIRED when .timeout returns neither BLK_EH_RESET_TIMER nor BLK_EH_HANDLED. Cc: "jianchao.wang" Cc: Bart Van Assche Cc: Tejun Heo Cc: Christoph Hellwig Cc: Ming Lei Cc: Sagi Grimberg Cc: Israel Rukshin , Cc: Max Gurtovoy Cc: Martin Steigerwald Signed-off-by: Ming Lei --- block/blk-mq.c | 4 ++-- block/blk-timeout.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 0dc9e341c2a7..d6a21898933d 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -815,8 +815,6 @@ static void blk_mq_rq_timed_out(struct request *req, bool reserved) const struct blk_mq_ops *ops = req->q->mq_ops; enum blk_eh_timer_return ret = BLK_EH_RESET_TIMER; - req->rq_flags |= RQF_MQ_TIMEOUT_EXPIRED; - if (ops->timeout) ret = ops->timeout(req, reserved); @@ -834,9 +832,11 @@ static void blk_mq_rq_timed_out(struct request *req, bool reserved) blk_add_timer(req); break; case BLK_EH_NOT_HANDLED: + req->rq_flags |= RQF_MQ_TIMEOUT_EXPIRED; break; default: printk(KERN_ERR "block: bad eh return: %d\n", ret); + req->rq_flags |= RQF_MQ_TIMEOUT_EXPIRED; break; } } diff --git a/block/blk-timeout.c b/block/blk-timeout.c index 652d4d4d3e97..f95d6e6cbc96 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c @@ -214,7 +214,6 @@ void blk_add_timer(struct request *req) req->timeout = q->rq_timeout; blk_rq_set_deadline(req, jiffies + req->timeout); - req->rq_flags &= ~RQF_MQ_TIMEOUT_EXPIRED; /* * Only the non-mq case needs to add the request to a protected list. -- 2.9.5