From: Bart Van Assche <bart.vanassche@wdc.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Bart Van Assche <bart.vanassche@wdc.com>,
Damien Le Moal <damien.lemoal@wdc.com>,
Hannes Reinecke <hare@suse.com>, Ming Lei <ming.lei@redhat.com>
Subject: [PATCH] blk-mq: Make sure that the affected zone is unlocked if a request times out
Date: Tue, 27 Feb 2018 16:28:30 -0800 [thread overview]
Message-ID: <20180228002830.3052-1-bart.vanassche@wdc.com> (raw)
If a request times out the .completed_request() method is not called
and the .finish_request() method is only called if RQF_ELVPRIV has
been set. Hence this patch that sets RQF_ELVPRIV and that adds a
.finish_request() method. Without this patch, if a request times out
the zone that request applies to remains locked forever and no further
writes are accepted for that zone.
Fixes: 5700f69178e9 ("mq-deadline: Introduce zone locking support")
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Ming Lei <ming.lei@redhat.com>
---
block/mq-deadline.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/block/mq-deadline.c b/block/mq-deadline.c
index c56f211c8440..55d5b7a02d62 100644
--- a/block/mq-deadline.c
+++ b/block/mq-deadline.c
@@ -367,7 +367,8 @@ static struct request *__dd_dispatch_request(struct deadline_data *dd)
* If the request needs its target zone locked, do it.
*/
blk_req_zone_write_lock(rq);
- rq->rq_flags |= RQF_STARTED;
+ /* Set RQF_ELVPRIV to ensure that .finish_request() gets called */
+ rq->rq_flags |= RQF_STARTED | RQF_ELVPRIV;
return rq;
}
@@ -539,7 +540,9 @@ static void dd_insert_requests(struct blk_mq_hw_ctx *hctx,
* For zoned block devices, write unlock the target zone of
* completed write requests. Do this while holding the zone lock
* spinlock so that the zone is never unlocked while deadline_fifo_request()
- * while deadline_next_request() are executing.
+ * while deadline_next_request() are executing. This function is called twice
+ * for requests that complete in a normal way and once for requests that time
+ * out.
*/
static void dd_completed_request(struct request *rq)
{
@@ -757,6 +760,7 @@ static struct elevator_type mq_deadline = {
.insert_requests = dd_insert_requests,
.dispatch_request = dd_dispatch_request,
.completed_request = dd_completed_request,
+ .finish_request = dd_completed_request,
.next_request = elv_rb_latter_request,
.former_request = elv_rb_former_request,
.bio_merge = dd_bio_merge,
--
2.16.2
next reply other threads:[~2018-02-28 0:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-28 0:28 Bart Van Assche [this message]
2018-02-28 1:35 ` [PATCH] blk-mq: Make sure that the affected zone is unlocked if a request times out Ming Lei
2018-02-28 2:21 ` Damien Le Moal
2018-02-28 3:09 ` Ming Lei
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=20180228002830.3052-1-bart.vanassche@wdc.com \
--to=bart.vanassche@wdc.com \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@wdc.com \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
/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