From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>,
Bart Van Assche <bart.vanassche@wdc.com>,
Martin Steigerwald <Martin@Lichtvoll.de>,
Israel Rukshin <israelr@mellanox.com>,
Ming Lei <ming.lei@redhat.com>,
"jianchao.wang" <jianchao.w.wang@oracle.com>,
Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
Max Gurtovoy <maxg@mellanox.com>
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 [thread overview]
Message-ID: <20180415154357.19788-2-ming.lei@redhat.com> (raw)
In-Reply-To: <20180415154357.19788-1-ming.lei@redhat.com>
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" <jianchao.w.wang@oracle.com>
Cc: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Israel Rukshin <israelr@mellanox.com>,
Cc: Max Gurtovoy <maxg@mellanox.com>
Cc: Martin Steigerwald <Martin@Lichtvoll.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
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
next prev parent reply other threads:[~2018-04-15 15:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-15 15:43 [PATCH V4 0/2] blk-mq: fix race between completion and BLK_EH_RESET_TIMER Ming Lei
2018-04-15 15:43 ` Ming Lei [this message]
2018-04-15 15:43 ` [PATCH V4 2/2] blk-mq: fix race between complete " Ming Lei
2018-04-15 16:31 ` [PATCH V4 0/2] blk-mq: fix race between completion " Martin Steigerwald
2018-04-16 0:45 ` Ming Lei
2018-04-16 13:12 ` Martin Steigerwald
2018-04-16 16:04 ` jianchao.wang
2018-04-17 0:15 ` Bart Van Assche
2018-04-17 3:49 ` jianchao.wang
2018-04-18 16:46 ` Ming Lei
2018-04-23 8:41 ` Martin Steigerwald
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180415154357.19788-2-ming.lei@redhat.com \
--to=ming.lei@redhat.com \
--cc=Martin@Lichtvoll.de \
--cc=axboe@kernel.dk \
--cc=bart.vanassche@wdc.com \
--cc=hch@lst.de \
--cc=israelr@mellanox.com \
--cc=jianchao.w.wang@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=maxg@mellanox.com \
--cc=sagi@grimberg.me \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox