Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: block: Introduce BLK_STS_DURATION_LIMIT

Introduce the new block I/O status BLK_STS_DURATION_LIMIT for LLDDs to
report command that failed due to a command duration limit being
exceeded. This new status is mapped to the ETIME error code to allow users
to differentiate "soft" duration limit failures from other more serious
hardware related errors.

If we compare BLK_STS_DURATION_LIMIT with BLK_STS_TIMEOUT:
-BLK_STS_DURATION_LIMIT means that the drive gave a reply indicating that
the command duration limit was exceeded before the command could be
completed. This I/O status is mapped to ETIME for user space.

-BLK_STS_TIMEOUT means that the drive never gave a reply at all.
This I/O status is mapped to ETIMEDOUT for user space.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Co-developed-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Link: https://lore.kernel.org/r/20230511011356.227789-4-nks@flawful.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Damien Le Moal and committed by
Martin K. Petersen
dffc480d 6c913257

+9
+3
block/blk-core.c
··· 170 170 [BLK_STS_ZONE_OPEN_RESOURCE] = { -ETOOMANYREFS, "open zones exceeded" }, 171 171 [BLK_STS_ZONE_ACTIVE_RESOURCE] = { -EOVERFLOW, "active zones exceeded" }, 172 172 173 + /* Command duration limit device-side timeout */ 174 + [BLK_STS_DURATION_LIMIT] = { -ETIME, "duration limit exceeded" }, 175 + 173 176 /* everything else not covered above: */ 174 177 [BLK_STS_IOERR] = { -EIO, "I/O" }, 175 178 };
+6
include/linux/blk_types.h
··· 171 171 */ 172 172 #define BLK_STS_OFFLINE ((__force blk_status_t)17) 173 173 174 + /* 175 + * BLK_STS_DURATION_LIMIT is returned from the driver when the target device 176 + * aborted the command because it exceeded one of its Command Duration Limits. 177 + */ 178 + #define BLK_STS_DURATION_LIMIT ((__force blk_status_t)18) 179 + 174 180 /** 175 181 * blk_path_error - returns true if error may be path related 176 182 * @error: status the request was completed with