From: Alexander Gordeev <agordeev@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Alexander Gordeev <agordeev@redhat.com>, Jens Axboe <axboe@kernel.dk>
Subject: [PATCH] blk-mq: bitmap tag: fix potential unwakeable sleep in bt_get()
Date: Mon, 21 Jul 2014 10:10:46 +0200 [thread overview]
Message-ID: <1405930246-2051-1-git-send-email-agordeev@redhat.com> (raw)
There is a race between __bt_get_word() and bt_clear_tag(). Since
access to the tags bitmap is not serialized __bt_get_word() might
miss a tag which is about to or being returned by bt_clear_tag().
As result, the process requesting the tag might end up schedulled
out forever.
To avoid this corner case call io_schedule_timeout() instead of
io_schedule(). The timeout should be long enough to not falsely
wake up waiters often, so take the requests queue's "rq_timeout"
for that.
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
---
block/blk-mq-tag.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index c1b9242..1785f1f 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -256,7 +256,7 @@ static int bt_get(struct blk_mq_alloc_data *data,
blk_mq_put_ctx(data->ctx);
- io_schedule();
+ WARN_ON(!io_schedule_timeout(hctx->queue->rq_timeout));
data->ctx = blk_mq_get_ctx(data->q);
data->hctx = data->q->mq_ops->map_queue(data->q,
--
1.7.7.6
next reply other threads:[~2014-07-21 8:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-21 8:10 Alexander Gordeev [this message]
2014-07-21 8:16 ` Jens Axboe
2014-07-21 8:32 ` Alexander Gordeev
2014-07-21 8:34 ` Jens Axboe
2014-07-21 9:11 ` Alexander Gordeev
2014-07-22 8:27 ` Alexander Gordeev
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=1405930246-2051-1-git-send-email-agordeev@redhat.com \
--to=agordeev@redhat.com \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®