From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: target-devel <target-devel@vger.kernel.org>,
linux-scsi <linux-scsi@vger.kernel.org>
Cc: Andy Grover <agrover@redhat.com>,
Kiran Patil <kiran.patil@intel.com>,
Arun Easi <arun.easi@qlogic.com>,
Nicholas Bellinger <nab@linux-iscsi.org>
Subject: [PATCH 3/7] target: Fix target_submit_tmr se_tmr_req allocation failures
Date: Sat, 25 Feb 2012 21:05:55 +0000 [thread overview]
Message-ID: <1330203959-6170-4-git-send-email-nab@linux-iscsi.org> (raw)
In-Reply-To: <1330203959-6170-1-git-send-email-nab@linux-iscsi.org>
From: Nicholas Bellinger <nab@linux-iscsi.org>
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>
---
drivers/target/target_core_transport.c | 19 ++++++++++---------
include/target/target_core_fabric.h | 2 +-
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index a526907..ce88cd2 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1715,7 +1715,7 @@ EXPORT_SYMBOL(target_submit_cmd);
* Callable from process context
**/
-void target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
+int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
unsigned char *sense, u32 unpacked_lun,
void *fabric_tmr_ptr, unsigned char tm_type, int flags)
{
@@ -1728,25 +1728,26 @@ void target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess,
0, DMA_NONE, MSG_SIMPLE_TAG, sense);
+ /*
+ * FIXME: Currently expect caller to handle se_cmd->se_tmr_req
+ * allocation failure.
+ */
+ ret = core_tmr_alloc_req(se_cmd, fabric_tmr_ptr, tm_type, GFP_KERNEL);
+ if (ret < 0)
+ return -ENOMEM;
/* See target_submit_cmd for commentary */
target_get_sess_cmd(se_sess, se_cmd, (flags & TARGET_SCF_ACK_KREF));
- ret = core_tmr_alloc_req(se_cmd, fabric_tmr_ptr, tm_type, GFP_KERNEL);
- if (ret < 0) {
- dump_stack();
- /* FIXME XXX */
- return;
- }
-
ret = transport_lookup_tmr_lun(se_cmd, unpacked_lun);
if (ret) {
se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST;
se_cmd->se_tfo->queue_tm_rsp(se_cmd);
transport_generic_free_cmd(se_cmd, 0);
- return;
+ return 0;
}
transport_generic_handle_tmr(se_cmd);
+ return 0;
}
EXPORT_SYMBOL(target_submit_tmr);
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index aefa435..a29092e 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -121,7 +121,7 @@ int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
int transport_handle_cdb_direct(struct se_cmd *);
void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
unsigned char *, u32, u32, int, int, int);
-void target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
+int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
unsigned char *sense, u32 unpacked_lun,
void *fabric_tmr_ptr, unsigned char tm_type, int flags);
int transport_generic_handle_cdb_map(struct se_cmd *);
--
1.7.2.5
next prev parent reply other threads:[~2012-02-25 21:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-25 21:05 [PATCH 0/7] target: Drop se_tmr_req inline + target_submit_tmr() fixes + conversion Nicholas A. Bellinger
2012-02-25 21:05 ` [PATCH 1/7] target: Drop inlining of se_tmr_req from se_cmd Nicholas A. Bellinger
2012-02-25 21:05 ` [PATCH 2/7] target: Fix target_submit_tmr LUN lookup failures Nicholas A. Bellinger
2012-02-25 21:05 ` Nicholas A. Bellinger [this message]
2012-02-25 21:05 ` [PATCH 4/7] tcm_fc: Handle target_submit_tmr allocation failure Nicholas A. Bellinger
2012-02-25 21:05 ` [PATCH 5/7] target: Push target_submit_tmr LUN lookup failure to system_wq context Nicholas A. Bellinger
2012-02-25 21:05 ` [PATCH 6/7] target: Allow target_submit_tmr to be called from interrupt context Nicholas A. Bellinger
2012-02-25 21:05 ` [PATCH 7/7] qla_target: Drop qla_tgt_mgmt_cmd->se_tmr_req usage Nicholas A. Bellinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1330203959-6170-4-git-send-email-nab@linux-iscsi.org \
--to=nab@linux-iscsi.org \
--cc=agrover@redhat.com \
--cc=arun.easi@qlogic.com \
--cc=kiran.patil@intel.com \
--cc=linux-scsi@vger.kernel.org \
--cc=target-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).