diff options
author | Roland Dreier <roland@purestorage.com> | 2012-07-16 14:04:39 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-07-17 20:05:05 -0400 |
commit | d6dfc868bcf329392abd1ecfa7357eb51ebf8c30 (patch) | |
tree | 7eb33785e4d6a59111560b56e68f4facaddee310 /drivers/usb | |
parent | 7409a6657aebf8be74c21d0eded80709b27275cb (diff) |
target: Allow for target_submit_cmd() returning errors
We want it to be possible for target_submit_cmd() to return errors up
to its fabric module callers. For now just update the prototype to
return an int, and update all callers to handle non-zero return values
as an error.
This is immediately useful for tcm_qla2xxx to fix a long-standing active
I/O session shutdown race, but tcm_fc, usb-gadget, and sbp-target the
fabric maintainers need to check + ACK that handling a target_submit_cmd()
failure due to session shutdown does not introduce regressions
(nab: Respin against for-next after initial NACK + update docbook comment +
fix double se_cmd init in exception path for usb-gadget)
Cc: Chad Dupuis <chad.dupuis@qlogic.com>
Cc: Arun Easi <arun.easi@qlogic.com>
Cc: Chris Boot <bootc@bootc.net>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Mark Rustad <mark.d.rustad@intel.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Andy Grover <agrover@redhat.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/tcm_usb_gadget.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c index 02ace18fca0b..5444866e13ef 100644 --- a/drivers/usb/gadget/tcm_usb_gadget.c +++ b/drivers/usb/gadget/tcm_usb_gadget.c | |||
@@ -1065,16 +1065,20 @@ static void usbg_cmd_work(struct work_struct *work) | |||
1065 | tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, | 1065 | tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, |
1066 | tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, | 1066 | tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, |
1067 | cmd->prio_attr, cmd->sense_iu.sense); | 1067 | cmd->prio_attr, cmd->sense_iu.sense); |
1068 | 1068 | goto out; | |
1069 | transport_send_check_condition_and_sense(se_cmd, | ||
1070 | TCM_UNSUPPORTED_SCSI_OPCODE, 1); | ||
1071 | usbg_cleanup_cmd(cmd); | ||
1072 | return; | ||
1073 | } | 1069 | } |
1074 | 1070 | ||
1075 | target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, | 1071 | if (target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, |
1076 | cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun, | 1072 | cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun, |
1077 | 0, cmd->prio_attr, dir, TARGET_SCF_UNKNOWN_SIZE); | 1073 | 0, cmd->prio_attr, dir, TARGET_SCF_UNKNOWN_SIZE) < 0) |
1074 | goto out; | ||
1075 | |||
1076 | return; | ||
1077 | |||
1078 | out: | ||
1079 | transport_send_check_condition_and_sense(se_cmd, | ||
1080 | TCM_UNSUPPORTED_SCSI_OPCODE, 1); | ||
1081 | usbg_cleanup_cmd(cmd); | ||
1078 | } | 1082 | } |
1079 | 1083 | ||
1080 | static int usbg_submit_command(struct f_uas *fu, | 1084 | static int usbg_submit_command(struct f_uas *fu, |
@@ -1177,16 +1181,20 @@ static void bot_cmd_work(struct work_struct *work) | |||
1177 | tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, | 1181 | tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, |
1178 | tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, | 1182 | tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, |
1179 | cmd->prio_attr, cmd->sense_iu.sense); | 1183 | cmd->prio_attr, cmd->sense_iu.sense); |
1180 | 1184 | goto out; | |
1181 | transport_send_check_condition_and_sense(se_cmd, | ||
1182 | TCM_UNSUPPORTED_SCSI_OPCODE, 1); | ||
1183 | usbg_cleanup_cmd(cmd); | ||
1184 | return; | ||
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, | 1187 | if (target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, |
1188 | cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun, | 1188 | cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun, |
1189 | cmd->data_len, cmd->prio_attr, dir, 0); | 1189 | cmd->data_len, cmd->prio_attr, dir, 0) < 0) |
1190 | goto out; | ||
1191 | |||
1192 | return; | ||
1193 | |||
1194 | out: | ||
1195 | transport_send_check_condition_and_sense(se_cmd, | ||
1196 | TCM_UNSUPPORTED_SCSI_OPCODE, 1); | ||
1197 | usbg_cleanup_cmd(cmd); | ||
1190 | } | 1198 | } |
1191 | 1199 | ||
1192 | static int bot_submit_command(struct f_uas *fu, | 1200 | static int bot_submit_command(struct f_uas *fu, |