Re: [PATCH AUTOSEL 5.2 129/249] blk-iolatency: only account submitted bios

From: Sasha Levin
Date: Sun Jul 21 2019 - 20:40:01 EST


On Mon, Jul 15, 2019 at 03:58:06PM -0400, Dennis Zhou wrote:
On Mon, Jul 15, 2019 at 09:44:54AM -0400, Sasha Levin wrote:
From: Dennis Zhou <dennis@xxxxxxxxxx>

[ Upstream commit a3fb01ba5af066521f3f3421839e501bb2c71805 ]

As is, iolatency recognizes done_bio and cleanup as ending paths. If a
request is marked REQ_NOWAIT and fails to get a request, the bio is
cleaned up via rq_qos_cleanup() and ended in bio_wouldblock_error().
This results in underflowing the inflight counter. Fix this by only
accounting bios that were actually submitted.

Signed-off-by: Dennis Zhou <dennis@xxxxxxxxxx>
Cc: Josef Bacik <josef@xxxxxxxxxxxxxx>
Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
block/blk-iolatency.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
index d22e61bced86..c91b84bb9d0a 100644
--- a/block/blk-iolatency.c
+++ b/block/blk-iolatency.c
@@ -600,6 +600,10 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio)
if (!blkg || !bio_flagged(bio, BIO_TRACKED))
return;

+ /* We didn't actually submit this bio, don't account it. */
+ if (bio->bi_status == BLK_STS_AGAIN)
+ return;
+
iolat = blkg_to_lat(bio->bi_blkg);
if (!iolat)
return;
--
2.20.1


Hi Sasha,

If you're going to pick this up, c9b3007feca0 ("blk-iolatency: fix
STS_AGAIN handling") fixes this patch, so please pick that up too.

I've picked it up, thanks!

--
Thanks,
Sasha