Skip to content

Commit

Permalink
Blk-iolatency: warn on negative inflight IO counter
Browse files Browse the repository at this point in the history
[ Upstream commit 391f552af213985d3d324c60004475759a7030c5 ]

This is to catch any unexpected negative value of inflight IO counter.

Signed-off-by: Liu Bo <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
liubogithub authored and gregkh committed Sep 16, 2019
1 parent 91a71a6 commit 5f33e81
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion block/blk-iolatency.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio)
u64 now = ktime_to_ns(ktime_get());
bool issue_as_root = bio_issue_as_root_blkg(bio);
bool enabled = false;
int inflight = 0;

blkg = bio->bi_blkg;
if (!blkg)
Expand All @@ -585,7 +586,8 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio)
}
rqw = &iolat->rq_wait;

atomic_dec(&rqw->inflight);
inflight = atomic_dec_return(&rqw->inflight);
WARN_ON_ONCE(inflight < 0);
if (iolat->min_lat_nsec == 0)
goto next;
iolatency_record_time(iolat, &bio->bi_issue, now,
Expand Down

0 comments on commit 5f33e81

Please sign in to comment.