diff options
author | Andy Grover <agrover@redhat.com> | 2012-01-19 16:39:23 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-02-07 01:41:04 -0500 |
commit | 1edcdb497ef418122cd4f98e157660cf594b345a (patch) | |
tree | bf41780935b8996f85a0ae090897495961deb6d7 | |
parent | 95fe1ee41e23fa271416da67483594dde74bc6ca (diff) |
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>
-rw-r--r-- | drivers/target/target_core_transport.c | 5 | ||||
-rw-r--r-- | drivers/target/tcm_fc/tfc_cmd.c | 9 | ||||
-rw-r--r-- | include/target/target_core_fabric.h | 2 |
3 files changed, 5 insertions, 11 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index cf996d81cfcb..aace7ee141f3 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1657,7 +1657,7 @@ EXPORT_SYMBOL(transport_handle_cdb_direct); | |||
1657 | * This may only be called from process context, and also currently | 1657 | * This may only be called from process context, and also currently |
1658 | * assumes internal allocation of fabric payload buffer by target-core. | 1658 | * assumes internal allocation of fabric payload buffer by target-core. |
1659 | **/ | 1659 | **/ |
1660 | int target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, | 1660 | void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, |
1661 | unsigned char *cdb, unsigned char *sense, u32 unpacked_lun, | 1661 | unsigned char *cdb, unsigned char *sense, u32 unpacked_lun, |
1662 | u32 data_length, int task_attr, int data_dir, int flags) | 1662 | u32 data_length, int task_attr, int data_dir, int flags) |
1663 | { | 1663 | { |
@@ -1706,12 +1706,11 @@ int target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, | |||
1706 | * when fabric has filled the incoming buffer. | 1706 | * when fabric has filled the incoming buffer. |
1707 | */ | 1707 | */ |
1708 | transport_handle_cdb_direct(se_cmd); | 1708 | transport_handle_cdb_direct(se_cmd); |
1709 | return 0; | 1709 | return; |
1710 | 1710 | ||
1711 | out_check_cond: | 1711 | out_check_cond: |
1712 | transport_send_check_condition_and_sense(se_cmd, | 1712 | transport_send_check_condition_and_sense(se_cmd, |
1713 | se_cmd->scsi_sense_reason, 0); | 1713 | se_cmd->scsi_sense_reason, 0); |
1714 | return 0; | ||
1715 | } | 1714 | } |
1716 | EXPORT_SYMBOL(target_submit_cmd); | 1715 | EXPORT_SYMBOL(target_submit_cmd); |
1717 | 1716 | ||
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index addc18f727ea..9e7e26c74c79 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c | |||
@@ -540,7 +540,6 @@ static void ft_send_work(struct work_struct *work) | |||
540 | int data_dir = 0; | 540 | int data_dir = 0; |
541 | u32 data_len; | 541 | u32 data_len; |
542 | int task_attr; | 542 | int task_attr; |
543 | int ret; | ||
544 | 543 | ||
545 | fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); | 544 | fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); |
546 | if (!fcp) | 545 | if (!fcp) |
@@ -603,14 +602,10 @@ static void ft_send_work(struct work_struct *work) | |||
603 | * Use a single se_cmd->cmd_kref as we expect to release se_cmd | 602 | * Use a single se_cmd->cmd_kref as we expect to release se_cmd |
604 | * directly from ft_check_stop_free callback in response path. | 603 | * directly from ft_check_stop_free callback in response path. |
605 | */ | 604 | */ |
606 | ret = target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb, | 605 | target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb, |
607 | &cmd->ft_sense_buffer[0], cmd->lun, data_len, | 606 | &cmd->ft_sense_buffer[0], cmd->lun, data_len, |
608 | task_attr, data_dir, 0); | 607 | task_attr, data_dir, 0); |
609 | pr_debug("r_ctl %x alloc target_submit_cmd %d\n", fh->fh_r_ctl, ret); | 608 | pr_debug("r_ctl %x alloc target_submit_cmd\n", fh->fh_r_ctl); |
610 | if (ret < 0) { | ||
611 | ft_dump_cmd(cmd, __func__); | ||
612 | return; | ||
613 | } | ||
614 | return; | 609 | return; |
615 | 610 | ||
616 | err: | 611 | err: |
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 523e8bc104d4..d36fad317e78 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h | |||
@@ -114,7 +114,7 @@ void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *, | |||
114 | struct se_session *, u32, int, int, unsigned char *); | 114 | struct se_session *, u32, int, int, unsigned char *); |
115 | int transport_lookup_cmd_lun(struct se_cmd *, u32); | 115 | int transport_lookup_cmd_lun(struct se_cmd *, u32); |
116 | int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); | 116 | int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); |
117 | int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, | 117 | void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, |
118 | unsigned char *, u32, u32, int, int, int); | 118 | unsigned char *, u32, u32, int, int, int); |
119 | int transport_handle_cdb_direct(struct se_cmd *); | 119 | int transport_handle_cdb_direct(struct se_cmd *); |
120 | int transport_generic_handle_cdb_map(struct se_cmd *); | 120 | int transport_generic_handle_cdb_map(struct se_cmd *); |