forked from Minki/linux
SCSI fixes on 20220429
One fix for an endless error loop with the target driver affecting tapes. Signed-off-by: James E.J. Bottomley <jejb@linux.ibm.com> -----BEGIN PGP SIGNATURE----- iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCYmypRyYcamFtZXMuYm90 dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pishVpgAQCElWgf TdEgYPSt9HmhN5dUHIJ5mDPJBuI+8SSJqAWdOAEAvNqEzj+LBwkkIaAXVOck/B/m v4JCIlIMG0BLQeWvm3Y= =awK6 -----END PGP SIGNATURE----- Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi Pull SCSI fix from James Bottomley: "One fix for an endless error loop with the target driver affecting tapes" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: target: pscsi: Set SCF_TREAT_READ_AS_NORMAL flag only if there is valid data
This commit is contained in:
commit
e9512f3668
@ -588,7 +588,7 @@ static void pscsi_destroy_device(struct se_device *dev)
|
||||
}
|
||||
|
||||
static void pscsi_complete_cmd(struct se_cmd *cmd, u8 scsi_status,
|
||||
unsigned char *req_sense)
|
||||
unsigned char *req_sense, int valid_data)
|
||||
{
|
||||
struct pscsi_dev_virt *pdv = PSCSI_DEV(cmd->se_dev);
|
||||
struct scsi_device *sd = pdv->pdv_sd;
|
||||
@ -681,7 +681,7 @@ after_mode_select:
|
||||
* back despite framework assumption that a
|
||||
* check condition means there is no data
|
||||
*/
|
||||
if (sd->type == TYPE_TAPE &&
|
||||
if (sd->type == TYPE_TAPE && valid_data &&
|
||||
cmd->data_direction == DMA_FROM_DEVICE) {
|
||||
/*
|
||||
* is sense data valid, fixed format,
|
||||
@ -1032,6 +1032,7 @@ static void pscsi_req_done(struct request *req, blk_status_t status)
|
||||
struct se_cmd *cmd = req->end_io_data;
|
||||
struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(req);
|
||||
enum sam_status scsi_status = scmd->result & 0xff;
|
||||
int valid_data = cmd->data_length - scmd->resid_len;
|
||||
u8 *cdb = cmd->priv;
|
||||
|
||||
if (scsi_status != SAM_STAT_GOOD) {
|
||||
@ -1039,12 +1040,11 @@ static void pscsi_req_done(struct request *req, blk_status_t status)
|
||||
" 0x%02x Result: 0x%08x\n", cmd, cdb[0], scmd->result);
|
||||
}
|
||||
|
||||
pscsi_complete_cmd(cmd, scsi_status, scmd->sense_buffer);
|
||||
pscsi_complete_cmd(cmd, scsi_status, scmd->sense_buffer, valid_data);
|
||||
|
||||
switch (host_byte(scmd->result)) {
|
||||
case DID_OK:
|
||||
target_complete_cmd_with_length(cmd, scsi_status,
|
||||
cmd->data_length - scmd->resid_len);
|
||||
target_complete_cmd_with_length(cmd, scsi_status, valid_data);
|
||||
break;
|
||||
default:
|
||||
pr_debug("PSCSI Host Byte exception at cmd: %p CDB:"
|
||||
|
Loading…
Reference in New Issue
Block a user