Skip to content

Commit

Permalink
blk-wbt: fix IO hang in wbt_wait()
Browse files Browse the repository at this point in the history
On wbt invariant is that if one IO is tracked via WBT_TRACKED, rqw->inflight
should be updated for tracking this IO.

But commit c1c8038 ("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: c1c8038 ("block: remove external dependency on wbt_flags")
Cc: Josef Bacik <[email protected]>
Reported-by: Ming Lei <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Ming Lei authored and axboe committed Aug 14, 2018
1 parent b089cfd commit df60f6e
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions block/blk-wbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,12 +576,8 @@ static void wbt_wait(struct rq_qos *rqos, struct bio *bio, spinlock_t *lock)
struct rq_wb *rwb = RQWB(rqos);
enum wbt_flags flags;

if (!rwb_enabled(rwb))
return;

flags = bio_to_wbt_flags(rwb, bio);

if (!wbt_should_throttle(rwb, bio)) {
if (!(flags & WBT_TRACKED)) {
if (flags & WBT_READ)
wb_timestamp(rwb, &rwb->last_issue);
return;
Expand Down

0 comments on commit df60f6e

Please sign in to comment.