diff options
author | Ming Lei <ming.lei@redhat.com> | 2018-08-14 11:57:49 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-08-14 13:05:52 -0400 |
commit | df60f6e835f763258a06cdbb5690a2e35c1aac4e (patch) | |
tree | 2313844fbbbc0204fadbca168205b46cc619071e | |
parent | b089cfd95d32638335c551651a8e00fd2c4edb0b (diff) |
blk-wbt: fix IO hang in wbt_wait()
On wbt invariant is that if one IO is tracked via WBT_TRACKED, rqw->inflight
should be updated for tracking this IO.
But commit c1c80384c8f ("block: remove external dependency on wbt_flags")
forgets to remove the early handling of !rwb_enabled(rwb) inside wbt_wait(),
then the inflight counter may not be increased in wbt_wait(), but decreased
in wbt_done() for this kind of IO, so this counter may become negative, then
wbt_wait() may wait forever.
This patch fixes the report in the following link:
https://marc.info/?l=linux-block&m=153221542021033&w=2
Fixes: c1c80384c8f ("block: remove external dependency on wbt_flags")
Cc: Josef Bacik <jbacik@fb.com>
Reported-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | block/blk-wbt.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 1d94a20374fc..bb93c7c2b182 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c | |||
@@ -576,12 +576,8 @@ static void wbt_wait(struct rq_qos *rqos, struct bio *bio, spinlock_t *lock) | |||
576 | struct rq_wb *rwb = RQWB(rqos); | 576 | struct rq_wb *rwb = RQWB(rqos); |
577 | enum wbt_flags flags; | 577 | enum wbt_flags flags; |
578 | 578 | ||
579 | if (!rwb_enabled(rwb)) | ||
580 | return; | ||
581 | |||
582 | flags = bio_to_wbt_flags(rwb, bio); | 579 | flags = bio_to_wbt_flags(rwb, bio); |
583 | 580 | if (!(flags & WBT_TRACKED)) { | |
584 | if (!wbt_should_throttle(rwb, bio)) { | ||
585 | if (flags & WBT_READ) | 581 | if (flags & WBT_READ) |
586 | wb_timestamp(rwb, &rwb->last_issue); | 582 | wb_timestamp(rwb, &rwb->last_issue); |
587 | return; | 583 | return; |