@@ -1454,7 +1454,7 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch,
}
return;
fail:
- transport_send_check_condition_and_sense(cmd, 0, 0); // XXX:
+ transport_send_check_condition_and_sense(cmd, 0); // XXX:
}
/**
@@ -2703,7 +2703,7 @@ static void ibmvscsis_parse_task(struct scsi_info *vscsi,
}
if (rc)
- transport_send_check_condition_and_sense(&cmd->se_cmd, 0, 0);
+ transport_send_check_condition_and_sense(&cmd->se_cmd, 0);
}
static void ibmvscsis_scheduler(struct work_struct *work)
@@ -1466,7 +1466,7 @@ static void iscsit_do_crypto_hash_buf(
pr_err("Received unexpected unsolicited data"
" while InitialR2T=Yes, protocol error.\n");
transport_send_check_condition_and_sense(&cmd->se_cmd,
- TCM_UNEXPECTED_UNSOLICITED_DATA, 0);
+ TCM_UNEXPECTED_UNSOLICITED_DATA);
return -1;
}
/*
@@ -163,7 +163,7 @@ static int iscsit_dataout_check_unsolicited_sequence(
" for this Unsolicited DataOut Burst.\n",
first_burst_len, conn->sess->sess_ops->FirstBurstLength);
transport_send_check_condition_and_sense(&cmd->se_cmd,
- TCM_INCORRECT_AMOUNT_OF_DATA, 0);
+ TCM_INCORRECT_AMOUNT_OF_DATA);
return DATAOUT_CANNOT_RECOVER;
}
@@ -188,7 +188,7 @@ static int iscsit_dataout_check_unsolicited_sequence(
conn->sess->sess_ops->FirstBurstLength,
cmd->se_cmd.data_length);
transport_send_check_condition_and_sense(&cmd->se_cmd,
- TCM_INCORRECT_AMOUNT_OF_DATA, 0);
+ TCM_INCORRECT_AMOUNT_OF_DATA);
return DATAOUT_CANNOT_RECOVER;
}
} else {
@@ -959,7 +959,7 @@ int iscsit_execute_cmd(struct iscsi_cmd *cmd, int ooo)
* exception
*/
return transport_send_check_condition_and_sense(se_cmd,
- cmd->sense_reason, 0);
+ cmd->sense_reason);
}
/*
* Special case for delayed CmdSN with Immediate
@@ -338,7 +338,7 @@ int iscsit_check_unsolicited_dataout(struct iscsi_cmd *cmd, unsigned char *buf)
pr_err("Received unexpected unsolicited data"
" while InitialR2T=Yes, protocol error.\n");
transport_send_check_condition_and_sense(se_cmd,
- TCM_UNEXPECTED_UNSOLICITED_DATA, 0);
+ TCM_UNEXPECTED_UNSOLICITED_DATA);
return -1;
}
@@ -349,7 +349,7 @@ int iscsit_check_unsolicited_dataout(struct iscsi_cmd *cmd, unsigned char *buf)
(cmd->first_burst_len + payload_length),
conn->sess->sess_ops->FirstBurstLength);
transport_send_check_condition_and_sense(se_cmd,
- TCM_INCORRECT_AMOUNT_OF_DATA, 0);
+ TCM_INCORRECT_AMOUNT_OF_DATA);
return -1;
}
@@ -365,7 +365,7 @@ int iscsit_check_unsolicited_dataout(struct iscsi_cmd *cmd, unsigned char *buf)
(cmd->first_burst_len + payload_length),
conn->sess->sess_ops->FirstBurstLength, cmd->se_cmd.data_length);
transport_send_check_condition_and_sense(se_cmd,
- TCM_INCORRECT_AMOUNT_OF_DATA, 0);
+ TCM_INCORRECT_AMOUNT_OF_DATA);
return -1;
}
return 0;
@@ -1496,7 +1496,7 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess
*/
rc = transport_lookup_cmd_lun(se_cmd, unpacked_lun);
if (rc) {
- transport_send_check_condition_and_sense(se_cmd, rc, 0);
+ transport_send_check_condition_and_sense(se_cmd, rc);
target_put_sess_cmd(se_cmd);
return 0;
}
@@ -1763,7 +1763,7 @@ void transport_generic_request_failure(struct se_cmd *cmd,
break;
}
- ret = transport_send_check_condition_and_sense(cmd, sense_reason, 0);
+ ret = transport_send_check_condition_and_sense(cmd, sense_reason);
if (ret)
goto queue_full;
@@ -2144,8 +2144,7 @@ static void target_complete_ok_work(struct work_struct *work)
*/
if (cmd->se_cmd_flags & SCF_TASK_SENSE) {
WARN_ON(!cmd->scsi_status);
- ret = transport_send_check_condition_and_sense(
- cmd, 0, 1);
+ ret = transport_send_check_condition_and_sense(cmd, 0);
if (ret)
goto queue_full;
@@ -2170,8 +2169,7 @@ static void target_complete_ok_work(struct work_struct *work)
return;
} else if (rc) {
- ret = transport_send_check_condition_and_sense(cmd,
- rc, 0);
+ ret = transport_send_check_condition_and_sense(cmd, rc);
if (ret)
goto queue_full;
@@ -2196,7 +2194,7 @@ static void target_complete_ok_work(struct work_struct *work)
*/
if (target_read_prot_action(cmd)) {
ret = transport_send_check_condition_and_sense(cmd,
- cmd->pi_err, 0);
+ cmd->pi_err);
if (ret)
goto queue_full;
@@ -3047,7 +3045,7 @@ int transport_setup_sense(struct se_cmd *cmd, sense_reason_t reason)
int
transport_send_check_condition_and_sense(struct se_cmd *cmd,
- sense_reason_t reason, int from_transport)
+ sense_reason_t reason)
{
unsigned long flags;
@@ -3059,7 +3057,7 @@ int transport_setup_sense(struct se_cmd *cmd, sense_reason_t reason)
cmd->se_cmd_flags |= SCF_SENT_CHECK_CONDITION;
spin_unlock_irqrestore(&cmd->t_state_lock, flags);
- if (!from_transport) {
+ if (!(cmd->se_cmd_flags & SCF_TASK_SENSE)) {
int rc;
rc = transport_setup_sense(cmd, reason);
@@ -809,7 +809,7 @@ static void vhost_scsi_submission_work(struct work_struct *work)
cmd->tvc_prot_sgl_count);
if (rc < 0) {
transport_send_check_condition_and_sense(se_cmd,
- TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0);
+ TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE);
transport_generic_free_cmd(se_cmd, 0);
}
}
@@ -412,7 +412,7 @@ static void scsiback_cmd_exec(struct vscsibk_pend *pending_req)
NULL, 0, NULL, 0);
if (rc < 0) {
transport_send_check_condition_and_sense(se_cmd,
- TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0);
+ TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE);
transport_generic_free_cmd(se_cmd, 0);
}
}
@@ -156,7 +156,7 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
int transport_check_aborted_status(struct se_cmd *, int);
int transport_setup_sense(struct se_cmd *, sense_reason_t);
int transport_send_check_condition_and_sense(struct se_cmd *,
- sense_reason_t, int);
+ sense_reason_t);
int target_get_sess_cmd(struct se_cmd *, bool);
int target_put_sess_cmd(struct se_cmd *);
void target_sess_cmd_list_set_waiting(struct se_session *);
No need to pass in from_transport to transport_send_check_condition_and_sense. If it is being called from the target_complete_ok_work path and modules like pscsi/tcmu have setup sense we can detect it by checking if SCF_TASK_SENSE is already set. Signed-off-by: Mike Christie <mchristi@redhat.com> --- drivers/infiniband/ulp/srpt/ib_srpt.c | 2 +- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 2 +- drivers/target/iscsi/iscsi_target.c | 2 +- drivers/target/iscsi/iscsi_target_erl0.c | 4 ++-- drivers/target/iscsi/iscsi_target_erl1.c | 2 +- drivers/target/iscsi/iscsi_target_util.c | 6 +++--- drivers/target/target_core_transport.c | 16 +++++++--------- drivers/vhost/scsi.c | 2 +- drivers/xen/xen-scsiback.c | 2 +- include/target/target_core_fabric.h | 2 +- 10 files changed, 19 insertions(+), 21 deletions(-)