Skip to content

scsi: target: pscsi: Set SCF_TREAT_READ_AS_NORMAL flag only if there is valid data

Maurizio Lombardi requested to merge (removed):bz2080216 into main

Merge Request Required Information

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2080216

Summary of Changes

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: bd813720 ("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 (cherry picked from commit 8be70a842f70c0fe8e00fd488b1966344fa10ff4) Signed-off-by: Maurizio Lombardi mlombard@redhat.com

Conflicts:

drivers/target/target_core_pscsi.c

(In the upstream kernel, scsi_req(req)->sense has been replaced by scmd->sense_buffer)

Edited by Maurizio Lombardi

Merge request reports