scsi: scsi_debug: Support injecting unaligned write errors
PATCH 1/1 scsi: scsi_debug: Support injecting unaligned write errors
Allow user space software, e.g. a blktests test, to inject unaligned write errors.
Acked-by Douglas Gilbert <[email protected]>
Reviewed-by Damien Le Moal <[email protected]>
Cc Martin K. Petersen <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Ming Lei <[email protected]>
Signed-off-by Bart Van Assche <[email protected]>
--- drivers/scsi/scsi_debug.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/scsi/scsi_debug.c +11 -1
@@ -230,6 +230,7 @@ struct tape_block {#define SDEBUG_OPT_NO_CDB_NOISE 0x4000#define SDEBUG_OPT_HOST_BUSY 0x8000#define SDEBUG_OPT_CMD_ABORT 0x10000 +#define SDEBUG_OPT_UNALIGNED_WRITE 0x20000#define SDEBUG_OPT_ALL_NOISE (SDEBUG_OPT_NOISE | SDEBUG_OPT_Q_NOISE | \ SDEBUG_OPT_RESET_NOISE)#define SDEBUG_OPT_ALL_INJECTING (SDEBUG_OPT_RECOVERED_ERR | \
@@ -237,7 +238,8 @@ struct tape_block { SDEBUG_OPT_DIF_ERR | SDEBUG_OPT_DIX_ERR | \ SDEBUG_OPT_SHORT_TRANSFER | \ SDEBUG_OPT_HOST_BUSY | \ - SDEBUG_OPT_CMD_ABORT) + SDEBUG_OPT_CMD_ABORT | \ + SDEBUG_OPT_UNALIGNED_WRITE)#define SDEBUG_OPT_RECOV_DIF_DIX (SDEBUG_OPT_RECOVERED_ERR | \ SDEBUG_OPT_DIF_ERR | SDEBUG_OPT_DIX_ERR)
@@ -4933,6 +4935,14 @@ static int resp_write_dt0(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)u8 *cmd = scp->cmnd;bool meta_data_locked = false; +if (unlikely (sdebug_opts &SDEBUG_OPT_UNALIGNED_WRITE && +atomic_read (&sdeb_inject_pending))) { +atomic_set (&sdeb_inject_pending,0 ); +mk_sense_buffer (scp,ILLEGAL_REQUEST ,LBA_OUT_OF_RANGE , +UNALIGNED_WRITE_ASCQ ); +return check_condition_result; + } +switch (cmd[0 ]) {case WRITE_16 : ei_lba =0 ;
Martin K. Petersen
AppliedBart,
Quoted 2 lines
Allow user space software, e.g. a blktests test, to inject unaligned write errors.
Applied to 6.19/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen
Martin K. Petersen
AppliedQuoted 4 lines · Bart Van Assche
Allow user space software, e.g. a blktests test, to inject unaligned write errors.
Applied to 6.19/scsi-queue, thanks!
[1/1] scsi: scsi_debug: Support injecting unaligned write errors
https://git.kernel.org/mkp/scsi/c/13b77ed9c2a9
Signature · 1 line
Martin K. Petersen