]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: target: pscsi: Set SCF_TREAT_READ_AS_NORMAL flag only if there is valid data
authorDavid Jeffery <djeffery@redhat.com>
Wed, 27 Apr 2022 18:32:50 +0000 (14:32 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 28 Apr 2022 02:40:09 +0000 (22:40 -0400)
commitb5b89629de7f4e6524cb3a2f3814d9366ae5b79f
tree6556e5cbfa4572a8849649aee72b80a66a77e3df
parent067aeaa6593ac1f3ab86c16d6e3b76ece15c6c50
scsi: target: pscsi: Set SCF_TREAT_READ_AS_NORMAL flag only if there is valid data

With tape devices, the SCF_TREAT_READ_AS_NORMAL flag is used by the target
subsystem to mark commands which have both data to return as well as sense
data. But with pscsi, SCF_TREAT_READ_AS_NORMAL can be set even if there is
no data to return. The SCF_TREAT_READ_AS_NORMAL flag causes the target core
to call iscsit data-in callbacks even if there is no data, which iscsit
does not support. This results in iscsit going into an error state
requiring recovery and being unable to complete the command to the
initiator.

This issue can be resolved by fixing pscsi to only set
SCF_TREAT_READ_AS_NORMAL if there is valid data to return alongside the
sense data.

Link: https://lore.kernel.org/r/20220427183250.291881-1-djeffery@redhat.com
Fixes: e630a97419ca ("scsi: target: transport should handle st FM/EOM/ILI reads")
Reported-by: Scott Hamilton <scott.hamilton@atos.net>
Tested-by: Laurence Oberman <loberman@redhat.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Signed-off-by: David Jeffery <djeffery@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/target/target_core_pscsi.c