scsi: target: Use standard SAM status types

target_complete_cmd() and friends requires a SAM status type, so passing
GOOD here is actually wrong.

Link: https://lore.kernel.org/r/20210427083046.31620-40-hare@suse.de
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Hannes Reinecke 2021-04-27 10:30:45 +02:00 committed by Martin K. Petersen
parent a7479a8477
commit 14b40c1e7c
7 changed files with 22 additions and 22 deletions

View File

@ -123,7 +123,7 @@ target_emulate_report_referrals(struct se_cmd *cmd)
transport_kunmap_data_sg(cmd); transport_kunmap_data_sg(cmd);
target_complete_cmd(cmd, GOOD); target_complete_cmd(cmd, SAM_STAT_GOOD);
return 0; return 0;
} }
@ -255,7 +255,7 @@ target_emulate_report_target_port_groups(struct se_cmd *cmd)
} }
transport_kunmap_data_sg(cmd); transport_kunmap_data_sg(cmd);
target_complete_cmd_with_length(cmd, GOOD, rd_len + 4); target_complete_cmd_with_length(cmd, SAM_STAT_GOOD, rd_len + 4);
return 0; return 0;
} }
@ -424,7 +424,7 @@ target_emulate_set_target_port_groups(struct se_cmd *cmd)
out: out:
transport_kunmap_data_sg(cmd); transport_kunmap_data_sg(cmd);
if (!rc) if (!rc)
target_complete_cmd(cmd, GOOD); target_complete_cmd(cmd, SAM_STAT_GOOD);
return rc; return rc;
} }

View File

@ -474,7 +474,7 @@ iblock_execute_zero_out(struct block_device *bdev, struct se_cmd *cmd)
if (ret) if (ret)
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
target_complete_cmd(cmd, GOOD); target_complete_cmd(cmd, SAM_STAT_GOOD);
return 0; return 0;
} }

View File

@ -234,7 +234,7 @@ target_scsi2_reservation_release(struct se_cmd *cmd)
out_unlock: out_unlock:
spin_unlock(&dev->dev_reservation_lock); spin_unlock(&dev->dev_reservation_lock);
out: out:
target_complete_cmd(cmd, GOOD); target_complete_cmd(cmd, SAM_STAT_GOOD);
return 0; return 0;
} }
@ -297,7 +297,7 @@ out_unlock:
spin_unlock(&dev->dev_reservation_lock); spin_unlock(&dev->dev_reservation_lock);
out: out:
if (!ret) if (!ret)
target_complete_cmd(cmd, GOOD); target_complete_cmd(cmd, SAM_STAT_GOOD);
return ret; return ret;
} }
@ -3676,7 +3676,7 @@ target_scsi3_emulate_pr_out(struct se_cmd *cmd)
} }
if (!ret) if (!ret)
target_complete_cmd(cmd, GOOD); target_complete_cmd(cmd, SAM_STAT_GOOD);
return ret; return ret;
} }
@ -4073,7 +4073,7 @@ target_scsi3_emulate_pr_in(struct se_cmd *cmd)
} }
if (!ret) if (!ret)
target_complete_cmd(cmd, GOOD); target_complete_cmd(cmd, SAM_STAT_GOOD);
return ret; return ret;
} }

View File

@ -1044,7 +1044,7 @@ static void pscsi_req_done(struct request *req, blk_status_t status)
struct se_cmd *cmd = req->end_io_data; struct se_cmd *cmd = req->end_io_data;
struct pscsi_plugin_task *pt = cmd->priv; struct pscsi_plugin_task *pt = cmd->priv;
int result = scsi_req(req)->result; int result = scsi_req(req)->result;
u8 scsi_status = status_byte(result) << 1; u8 scsi_status = result & 0xff;
if (scsi_status != SAM_STAT_GOOD) { if (scsi_status != SAM_STAT_GOOD) {
pr_debug("PSCSI Status Byte exception at cmd: %p CDB:" pr_debug("PSCSI Status Byte exception at cmd: %p CDB:"

View File

@ -67,7 +67,7 @@ sbc_emulate_readcapacity(struct se_cmd *cmd)
transport_kunmap_data_sg(cmd); transport_kunmap_data_sg(cmd);
} }
target_complete_cmd_with_length(cmd, GOOD, 8); target_complete_cmd_with_length(cmd, SAM_STAT_GOOD, 8);
return 0; return 0;
} }
@ -130,7 +130,7 @@ sbc_emulate_readcapacity_16(struct se_cmd *cmd)
transport_kunmap_data_sg(cmd); transport_kunmap_data_sg(cmd);
} }
target_complete_cmd_with_length(cmd, GOOD, 32); target_complete_cmd_with_length(cmd, SAM_STAT_GOOD, 32);
return 0; return 0;
} }
@ -202,14 +202,14 @@ sbc_execute_write_same_unmap(struct se_cmd *cmd)
return ret; return ret;
} }
target_complete_cmd(cmd, GOOD); target_complete_cmd(cmd, SAM_STAT_GOOD);
return 0; return 0;
} }
static sense_reason_t static sense_reason_t
sbc_emulate_noop(struct se_cmd *cmd) sbc_emulate_noop(struct se_cmd *cmd)
{ {
target_complete_cmd(cmd, GOOD); target_complete_cmd(cmd, SAM_STAT_GOOD);
return 0; return 0;
} }
@ -1245,7 +1245,7 @@ sbc_execute_unmap(struct se_cmd *cmd)
err: err:
transport_kunmap_data_sg(cmd); transport_kunmap_data_sg(cmd);
if (!ret) if (!ret)
target_complete_cmd(cmd, GOOD); target_complete_cmd(cmd, SAM_STAT_GOOD);
return ret; return ret;
} }

View File

@ -781,7 +781,7 @@ out:
kfree(buf); kfree(buf);
if (!ret) if (!ret)
target_complete_cmd_with_length(cmd, GOOD, len); target_complete_cmd_with_length(cmd, SAM_STAT_GOOD, len);
return ret; return ret;
} }
@ -1135,7 +1135,7 @@ set_length:
transport_kunmap_data_sg(cmd); transport_kunmap_data_sg(cmd);
} }
target_complete_cmd_with_length(cmd, GOOD, length); target_complete_cmd_with_length(cmd, SAM_STAT_GOOD, length);
return 0; return 0;
} }
@ -1153,7 +1153,7 @@ static sense_reason_t spc_emulate_modeselect(struct se_cmd *cmd)
int i; int i;
if (!cmd->data_length) { if (!cmd->data_length) {
target_complete_cmd(cmd, GOOD); target_complete_cmd(cmd, SAM_STAT_GOOD);
return 0; return 0;
} }
@ -1196,7 +1196,7 @@ out:
transport_kunmap_data_sg(cmd); transport_kunmap_data_sg(cmd);
if (!ret) if (!ret)
target_complete_cmd(cmd, GOOD); target_complete_cmd(cmd, SAM_STAT_GOOD);
return ret; return ret;
} }
@ -1229,7 +1229,7 @@ static sense_reason_t spc_emulate_request_sense(struct se_cmd *cmd)
memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length));
transport_kunmap_data_sg(cmd); transport_kunmap_data_sg(cmd);
target_complete_cmd(cmd, GOOD); target_complete_cmd(cmd, SAM_STAT_GOOD);
return 0; return 0;
} }
@ -1296,7 +1296,7 @@ done:
transport_kunmap_data_sg(cmd); transport_kunmap_data_sg(cmd);
} }
target_complete_cmd_with_length(cmd, GOOD, 8 + lun_count * 8); target_complete_cmd_with_length(cmd, SAM_STAT_GOOD, 8 + lun_count * 8);
return 0; return 0;
} }
EXPORT_SYMBOL(spc_emulate_report_luns); EXPORT_SYMBOL(spc_emulate_report_luns);
@ -1304,7 +1304,7 @@ EXPORT_SYMBOL(spc_emulate_report_luns);
static sense_reason_t static sense_reason_t
spc_emulate_testunitready(struct se_cmd *cmd) spc_emulate_testunitready(struct se_cmd *cmd)
{ {
target_complete_cmd(cmd, GOOD); target_complete_cmd(cmd, SAM_STAT_GOOD);
return 0; return 0;
} }

View File

@ -998,7 +998,7 @@ static sense_reason_t target_rcr_operating_parameters(struct se_cmd *se_cmd)
put_unaligned_be32(42, &p[0]); put_unaligned_be32(42, &p[0]);
transport_kunmap_data_sg(se_cmd); transport_kunmap_data_sg(se_cmd);
target_complete_cmd(se_cmd, GOOD); target_complete_cmd(se_cmd, SAM_STAT_GOOD);
return TCM_NO_SENSE; return TCM_NO_SENSE;
} }