From: Liu Bo <bo.liu@linux.alibaba.com>
To: linux-block@vger.kernel.org
Cc: Josef Bacik <josef@toxicpanda.com>, Jens Axboe <axboe@kernel.dk>
Subject: [PATCH v2 2/3] Blk-iolatency: warn on negative inflight IO counter
Date: Fri, 25 Jan 2019 08:12:48 +0800 [thread overview]
Message-ID: <20190125001249.72688-3-bo.liu@linux.alibaba.com> (raw)
In-Reply-To: <20190125001249.72688-1-bo.liu@linux.alibaba.com>
This is to catch any unexpected negative value of inflight IO counter.
Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
---
block/blk-iolatency.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
index 1893686a9c1f..2620baa1f699 100644
--- a/block/blk-iolatency.c
+++ b/block/blk-iolatency.c
@@ -592,6 +592,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 || !bio_flagged(bio, BIO_TRACKED))
@@ -613,7 +614,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,
--
2.20.1.2.gb21ebb6
next prev parent reply other threads:[~2019-01-25 0:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-25 0:12 [PATCH v2 0/3] iolatency bug fix Liu Bo
2019-01-25 0:12 ` [PATCH v2 1/3] blk-iolatency: fix IO hang due to negative inflight counter Liu Bo
2019-01-25 8:30 ` Johannes Thumshirn
2019-01-29 23:55 ` Liu Bo
2019-01-25 0:12 ` Liu Bo [this message]
2019-01-25 0:12 ` [PATCH v2 3/3] blk-mq: remove duplicated definition of blk_mq_freeze_queue Liu Bo
2019-02-08 19:14 ` [PATCH v2 0/3] iolatency bug fix Liu Bo
2019-02-08 19:42 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190125001249.72688-3-bo.liu@linux.alibaba.com \
--to=bo.liu@linux.alibaba.com \
--cc=axboe@kernel.dk \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox