Skip to content

Commit 391f552

Browse files
liubogithubaxboe
authored andcommitted
Blk-iolatency: warn on negative inflight IO counter
This is to catch any unexpected negative value of inflight IO counter. Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 8c772a9 commit 391f552

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

block/blk-iolatency.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio)
592592
u64 now = ktime_to_ns(ktime_get());
593593
bool issue_as_root = bio_issue_as_root_blkg(bio);
594594
bool enabled = false;
595+
int inflight = 0;
595596

596597
blkg = bio->bi_blkg;
597598
if (!blkg || !bio_flagged(bio, BIO_TRACKED))
@@ -613,7 +614,8 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio)
613614
}
614615
rqw = &iolat->rq_wait;
615616

616-
atomic_dec(&rqw->inflight);
617+
inflight = atomic_dec_return(&rqw->inflight);
618+
WARN_ON_ONCE(inflight < 0);
617619
if (iolat->min_lat_nsec == 0)
618620
goto next;
619621
iolatency_record_time(iolat, &bio->bi_issue, now,

0 commit comments

Comments
 (0)