Linux block layer
 help / color / mirror / Atom feed
* [PATCH block/for-5.6-fixes] blk-iocost: fix incorrect vtime comparison in iocg_is_idle()
@ 2020-03-10 17:07 Tejun Heo
  2020-03-10 17:37 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Tejun Heo @ 2020-03-10 17:07 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, linux-kernel

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: Tejun Heo <tj@kernel.org>
Fixes: 7caa47151ab2 ("blkcg: implement blk-iocost")
Cc: stable@vger.kernel.org # v5.4+
---
 block/blk-iocost.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 27ca68621137..9a599cc28c29 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH block/for-5.6-fixes] blk-iocost: fix incorrect vtime comparison in iocg_is_idle()
  2020-03-10 17:07 [PATCH block/for-5.6-fixes] blk-iocost: fix incorrect vtime comparison in iocg_is_idle() Tejun Heo
@ 2020-03-10 17:37 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-03-10 17:37 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-block, linux-kernel

On 3/10/20 11:07 AM, Tejun Heo wrote:
> 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.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-10 17:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-10 17:07 [PATCH block/for-5.6-fixes] blk-iocost: fix incorrect vtime comparison in iocg_is_idle() Tejun Heo
2020-03-10 17:37 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox