target: Change target_submit_cmd() to return void

Retval not very useful, and may even be harmful. Once submitted, fabrics
should expect a sense error if anything goes wrong. All fabrics checking
of this retval are useless or broken:

fc checks it just to emit more debug output.
ib_srpt trickles retval up, then it is ignored.
qla2xxx trickles it up, which then causes a bug because the abort goto
in qla_target.c thinks cmd hasn't been sent to target.

Just returning nothing is best.

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
Andy Grover 2012-01-19 13:39:23 -08:00 committed by Nicholas Bellinger
parent 95fe1ee41e
commit 1edcdb497e
3 changed files with 5 additions and 11 deletions

View File

@ -1657,7 +1657,7 @@ EXPORT_SYMBOL(transport_handle_cdb_direct);
* This may only be called from process context, and also currently * This may only be called from process context, and also currently
* assumes internal allocation of fabric payload buffer by target-core. * assumes internal allocation of fabric payload buffer by target-core.
**/ **/
int target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess,
unsigned char *cdb, unsigned char *sense, u32 unpacked_lun, unsigned char *cdb, unsigned char *sense, u32 unpacked_lun,
u32 data_length, int task_attr, int data_dir, int flags) u32 data_length, int task_attr, int data_dir, int flags)
{ {
@ -1706,12 +1706,11 @@ int target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess,
* when fabric has filled the incoming buffer. * when fabric has filled the incoming buffer.
*/ */
transport_handle_cdb_direct(se_cmd); transport_handle_cdb_direct(se_cmd);
return 0; return;
out_check_cond: out_check_cond:
transport_send_check_condition_and_sense(se_cmd, transport_send_check_condition_and_sense(se_cmd,
se_cmd->scsi_sense_reason, 0); se_cmd->scsi_sense_reason, 0);
return 0;
} }
EXPORT_SYMBOL(target_submit_cmd); EXPORT_SYMBOL(target_submit_cmd);

View File

@ -540,7 +540,6 @@ static void ft_send_work(struct work_struct *work)
int data_dir = 0; int data_dir = 0;
u32 data_len; u32 data_len;
int task_attr; int task_attr;
int ret;
fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp));
if (!fcp) if (!fcp)
@ -603,14 +602,10 @@ static void ft_send_work(struct work_struct *work)
* Use a single se_cmd->cmd_kref as we expect to release se_cmd * Use a single se_cmd->cmd_kref as we expect to release se_cmd
* directly from ft_check_stop_free callback in response path. * directly from ft_check_stop_free callback in response path.
*/ */
ret = target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb, target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb,
&cmd->ft_sense_buffer[0], cmd->lun, data_len, &cmd->ft_sense_buffer[0], cmd->lun, data_len,
task_attr, data_dir, 0); task_attr, data_dir, 0);
pr_debug("r_ctl %x alloc target_submit_cmd %d\n", fh->fh_r_ctl, ret); pr_debug("r_ctl %x alloc target_submit_cmd\n", fh->fh_r_ctl);
if (ret < 0) {
ft_dump_cmd(cmd, __func__);
return;
}
return; return;
err: err:

View File

@ -114,7 +114,7 @@ void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *,
struct se_session *, u32, int, int, unsigned char *); struct se_session *, u32, int, int, unsigned char *);
int transport_lookup_cmd_lun(struct se_cmd *, u32); int transport_lookup_cmd_lun(struct se_cmd *, u32);
int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
unsigned char *, u32, u32, int, int, int); unsigned char *, u32, u32, int, int, int);
int transport_handle_cdb_direct(struct se_cmd *); int transport_handle_cdb_direct(struct se_cmd *);
int transport_generic_handle_cdb_map(struct se_cmd *); int transport_generic_handle_cdb_map(struct se_cmd *);