]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
scsi: scsi_debug: Fix hrtimer support for ndelay
authorJohn Garry <john.g.garry@oracle.com>
Mon, 2 Dec 2024 13:00:45 +0000 (13:00 +0000)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 4 Dec 2024 18:22:59 +0000 (13:22 -0500)
Since commit 771f712ba5b0 ("scsi: scsi_debug: Fix cmd duration
calculation"), ns_from_boot value is only evaluated in schedule_resp()
for polled requests.

However, ns_from_boot is also required for hrtimer support for when
ndelay is less than INCLUSIVE_TIMING_MAX_NS, so fix up the logic to
decide when to evaluate ns_from_boot.

Fixes: 771f712ba5b0 ("scsi: scsi_debug: Fix cmd duration calculation")
Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20241202130045.2335194-1-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_debug.c

index b52513eeeafa759d8c01bd67f3213da06fc72cc1..680ba180a672525ba23350e631b83092fc8289a7 100644 (file)
@@ -6447,7 +6447,7 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
        }
        sd_dp = &sqcp->sd_dp;
 
-       if (polled)
+       if (polled || (ndelay > 0 && ndelay < INCLUSIVE_TIMING_MAX_NS))
                ns_from_boot = ktime_get_boottime_ns();
 
        /* one of the resp_*() response functions is called here */