linux/drivers/target
bstroesser@ts.fujitsu.com 6c3796d130 scsi: target: tcmu: add read length support
Generally target core and TCMUser seem to work fine for tape devices and
media changers.  But there is at least one situation where TCMUser is not
able to support sequential access device emulation correctly.

The situation is when an initiator sends a SCSI READ CDB with a length that
is greater than the length of the tape block to read. We can distinguish
two subcases:

A) The initiator sent the READ CDB with the SILI bit being set.

   In this case the sequential access device has to transfer the data from
   the tape block (only the length of the tape block) and transmit a good
   status.  The current interface between TCMUser and the userspace does
   not support reduction of the read data size by the userspace program.

   The patch below fixes this subcase by allowing the userspace program to
   specify a reduced data size in read direction.

B) The initiator sent the READ CDB with the SILI bit not being set.

   In this case the sequential access device has to transfer the data from
   the tape block as in A), but additionally has to transmit CHECK
   CONDITION with the ILI bit set and NO SENSE in the sensebytes. The
   information field in the sensebytes must contain the residual count.

   With the below patch a user space program can specify the real read data
   length and appropriate sensebytes.  TCMUser then uses the se_cmd flag
   SCF_TREAT_READ_AS_NORMAL, to force target core to transmit the real data
   size and the sensebytes.  Note: the flag SCF_TREAT_READ_AS_NORMAL is
   introduced by Lee Duncan's patch "[PATCH v4] target: transport should
   handle st FM/EOM/ILI reads" from Tue, 15 May 2018 18:25:24 -0700.

Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-06-18 21:02:52 -04:00
..
iscsi for-4.17/block-20180402 2018-04-05 14:27:02 -07:00
loopback
sbp
tcm_fc
Kconfig
Makefile
target_core_alua.c
target_core_alua.h
target_core_configfs.c scsi: target: prefer dbroot of /etc/target over /var/target 2018-04-19 00:47:02 -04:00
target_core_device.c
target_core_fabric_configfs.c
target_core_fabric_lib.c
target_core_file.c scsi: target: target/file: Add support of direct and async I/O 2018-05-14 22:40:08 -04:00
target_core_file.h scsi: target: target/file: Add support of direct and async I/O 2018-05-14 22:40:08 -04:00
target_core_hba.c
target_core_iblock.c target: convert to bioset_init()/mempool_init() 2018-05-30 15:33:32 -06:00
target_core_iblock.h target: convert to bioset_init()/mempool_init() 2018-05-30 15:33:32 -06:00
target_core_internal.h scsi: target: prefer dbroot of /etc/target over /var/target 2018-04-19 00:47:02 -04:00
target_core_pr.c
target_core_pr.h
target_core_pscsi.c SCSI misc on 20180610 2018-06-10 13:01:12 -07:00
target_core_pscsi.h
target_core_rd.c
target_core_rd.h
target_core_sbc.c
target_core_spc.c
target_core_stat.c
target_core_tmr.c
target_core_tpg.c
target_core_transport.c treewide: Use array_size() in vzalloc() 2018-06-12 16:19:22 -07:00
target_core_ua.c
target_core_ua.h
target_core_user.c scsi: target: tcmu: add read length support 2018-06-18 21:02:52 -04:00
target_core_xcopy.c
target_core_xcopy.h