blktrace.c: Don't sleep indefinitely if there is a wrong timestamp
authorLukas Straub <lukasstraub2@web.de>
Wed, 19 Jan 2022 21:14:33 +0000 (21:14 +0000)
committerJens Axboe <axboe@kernel.dk>
Thu, 20 Jan 2022 18:40:42 +0000 (11:40 -0700)
Each of my traces have a single entry with a wrong timestamp
that causes a underflow followed by a infinite sleep.

Fix this by checking for underflow.

Signed-off-by: Lukas Straub <lukasstraub2@web.de>
Link: https://lore.kernel.org/r/a19b7ea899093c4c0ed98d2d9a310f2f0f01fddd.1642626314.git.lukasstraub2@web.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
blktrace.c

index 7682a4d5dd0b82e24a568087d2d8a17b3f33ce4d..1faa83bf0332f953b9eec619006c3ecf729c2478 100644 (file)
@@ -307,7 +307,7 @@ static bool queue_trace(struct thread_data *td, struct blk_io_trace *t,
                return false;
 
        if (!(t->action & BLK_TC_ACT(BLK_TC_NOTIFY))) {
-               if (!last_ttime || td->o.no_stall)
+               if (!last_ttime || td->o.no_stall || t->time < last_ttime)
                        delay = 0;
                else if (td->o.replay_time_scale == 100)
                        delay = t->time - last_ttime;