Commit dcd6589b authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe
Browse files

blk-iocost: fix incorrect vtime comparison in iocg_is_idle()



vtimes may wrap and time_before/after64() should be used to determine
whether a given vtime is before or after another. iocg_is_idle() was
incorrectly using plain "<" comparison do determine whether done_vtime
is before vtime. Here, the only thing we're interested in is whether
done_vtime matches vtime which indicates that there's nothing in
flight. Let's test for inequality instead.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Fixes: 7caa4715 ("blkcg: implement blk-iocost")
Cc: stable@vger.kernel.org # v5.4+
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 14afc593
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1318,7 +1318,7 @@ static bool iocg_is_idle(struct ioc_gq *iocg)
		return false;

	/* is something in flight? */
	if (atomic64_read(&iocg->done_vtime) < atomic64_read(&iocg->vtime))
	if (atomic64_read(&iocg->done_vtime) != atomic64_read(&iocg->vtime))
		return false;

	return true;