diff options
author | Liu Bo <bo.liu@linux.alibaba.com> | 2019-01-25 08:12:48 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-16 08:21:41 +0200 |
commit | 5f33e81250a6b555d0011cdcecbdc4a83392fff8 (patch) | |
tree | 7cfa1e80d234d5c3aec4bcad291c832e60759df1 /block | |
parent | 91a71a61da8c7400274b2d5c82e8354ea1b19245 (diff) | |
download | linux-stable-5f33e81250a6b555d0011cdcecbdc4a83392fff8.tar.gz linux-stable-5f33e81250a6b555d0011cdcecbdc4a83392fff8.tar.bz2 linux-stable-5f33e81250a6b555d0011cdcecbdc4a83392fff8.zip |
Blk-iolatency: warn on negative inflight IO counter
[ Upstream commit 391f552af213985d3d324c60004475759a7030c5 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-iolatency.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c index f4f7c73fb828..84ecdab41b69 100644 --- a/block/blk-iolatency.c +++ b/block/blk-iolatency.c @@ -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) @@ -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, |