diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-02-25 04:40:24 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-02-25 21:38:34 -0500 |
commit | c7042cae58c13970f39c0820a3aab2a13dda9fe1 (patch) | |
tree | 63d75c4c8e37d9a26033ed11b47345b4ae697524 /drivers/target | |
parent | 3de55ec74aa803d7aa1e581700086d755c2599d2 (diff) |
target: Fix target_submit_tmr se_tmr_req allocation failures
This patch makes target_submit_tmr() se_tmr_req allocation occur before
target_get_sess_cmd(), and changes target_submit_tmr() to return a failure
w/ non zero status to the fabric caller upon core_tmr_alloc_req() failure.
Cc: Andy Grover <agrover@redhat.com>
Cc: Kiran Patil <kiran.patil@intel.com>
Cc: Arun Easi <arun.easi@qlogic.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_transport.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index d44cbc2113e5..96e78f3f461d 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1704,11 +1704,12 @@ EXPORT_SYMBOL(target_submit_cmd); | |||
1704 | * @unpacked_lun: unpacked LUN to reference for struct se_lun | 1704 | * @unpacked_lun: unpacked LUN to reference for struct se_lun |
1705 | * @fabric_context: fabric context for TMR req | 1705 | * @fabric_context: fabric context for TMR req |
1706 | * @tm_type: Type of TM request | 1706 | * @tm_type: Type of TM request |
1707 | * @flags: submit cmd flags | ||
1707 | * | 1708 | * |
1708 | * Callable from all contexts. | 1709 | * Callable from all contexts. |
1709 | **/ | 1710 | **/ |
1710 | 1711 | ||
1711 | void target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, | 1712 | int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, |
1712 | unsigned char *sense, u32 unpacked_lun, | 1713 | unsigned char *sense, u32 unpacked_lun, |
1713 | void *fabric_tmr_ptr, unsigned char tm_type, int flags) | 1714 | void *fabric_tmr_ptr, unsigned char tm_type, int flags) |
1714 | { | 1715 | { |
@@ -1720,25 +1721,26 @@ void target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, | |||
1720 | 1721 | ||
1721 | transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, | 1722 | transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, |
1722 | 0, DMA_NONE, MSG_SIMPLE_TAG, sense); | 1723 | 0, DMA_NONE, MSG_SIMPLE_TAG, sense); |
1724 | /* | ||
1725 | * FIXME: Currently expect caller to handle se_cmd->se_tmr_req | ||
1726 | * allocation failure. | ||
1727 | */ | ||
1728 | ret = core_tmr_alloc_req(se_cmd, fabric_tmr_ptr, tm_type, GFP_KERNEL); | ||
1729 | if (ret < 0) | ||
1730 | return -ENOMEM; | ||
1723 | 1731 | ||
1724 | /* See target_submit_cmd for commentary */ | 1732 | /* See target_submit_cmd for commentary */ |
1725 | target_get_sess_cmd(se_sess, se_cmd, (flags & TARGET_SCF_ACK_KREF)); | 1733 | target_get_sess_cmd(se_sess, se_cmd, (flags & TARGET_SCF_ACK_KREF)); |
1726 | 1734 | ||
1727 | ret = core_tmr_alloc_req(se_cmd, fabric_tmr_ptr, tm_type, GFP_KERNEL); | ||
1728 | if (ret < 0) { | ||
1729 | dump_stack(); | ||
1730 | /* FIXME XXX */ | ||
1731 | return; | ||
1732 | } | ||
1733 | |||
1734 | ret = transport_lookup_tmr_lun(se_cmd, unpacked_lun); | 1735 | ret = transport_lookup_tmr_lun(se_cmd, unpacked_lun); |
1735 | if (ret) { | 1736 | if (ret) { |
1736 | se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; | 1737 | se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; |
1737 | se_cmd->se_tfo->queue_tm_rsp(se_cmd); | 1738 | se_cmd->se_tfo->queue_tm_rsp(se_cmd); |
1738 | transport_generic_free_cmd(se_cmd, 0); | 1739 | transport_generic_free_cmd(se_cmd, 0); |
1739 | return; | 1740 | return 0; |
1740 | } | 1741 | } |
1741 | transport_generic_handle_tmr(se_cmd); | 1742 | transport_generic_handle_tmr(se_cmd); |
1743 | return 0; | ||
1742 | } | 1744 | } |
1743 | EXPORT_SYMBOL(target_submit_tmr); | 1745 | EXPORT_SYMBOL(target_submit_tmr); |
1744 | 1746 | ||