From: Roland Dreier <roland@kernel.org>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org,
Chris Boot <bootc@bootc.net>,
Stefan Richter <stefanr@s5r6.in-berlin.de>
Subject: [PATCH 3/7] sbp-target: Consolidate duplicated error path code in sbp_handle_command()
Date: Mon, 16 Jul 2012 11:04:38 -0700 [thread overview]
Message-ID: <1342461882-5848-4-git-send-email-roland@kernel.org> (raw)
In-Reply-To: <1342461882-5848-1-git-send-email-roland@kernel.org>
From: Roland Dreier <roland@purestorage.com>
Cc: Chris Boot <bootc@bootc.net>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Roland Dreier <roland@purestorage.com>
---
drivers/target/sbp/sbp_target.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
index 7e6136e..2425ca4 100644
--- a/drivers/target/sbp/sbp_target.c
+++ b/drivers/target/sbp/sbp_target.c
@@ -1219,28 +1219,14 @@ static void sbp_handle_command(struct sbp_target_request *req)
ret = sbp_fetch_command(req);
if (ret) {
pr_debug("sbp_handle_command: fetch command failed: %d\n", ret);
- req->status.status |= cpu_to_be32(
- STATUS_BLOCK_RESP(STATUS_RESP_TRANSPORT_FAILURE) |
- STATUS_BLOCK_DEAD(0) |
- STATUS_BLOCK_LEN(1) |
- STATUS_BLOCK_SBP_STATUS(SBP_STATUS_UNSPECIFIED_ERROR));
- sbp_send_status(req);
- sbp_free_request(req);
- return;
+ goto err;
}
ret = sbp_fetch_page_table(req);
if (ret) {
pr_debug("sbp_handle_command: fetch page table failed: %d\n",
ret);
- req->status.status |= cpu_to_be32(
- STATUS_BLOCK_RESP(STATUS_RESP_TRANSPORT_FAILURE) |
- STATUS_BLOCK_DEAD(0) |
- STATUS_BLOCK_LEN(1) |
- STATUS_BLOCK_SBP_STATUS(SBP_STATUS_UNSPECIFIED_ERROR));
- sbp_send_status(req);
- sbp_free_request(req);
- return;
+ goto err;
}
unpacked_lun = req->login->lun->unpacked_lun;
@@ -1252,6 +1238,16 @@ static void sbp_handle_command(struct sbp_target_request *req)
target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf,
req->sense_buf, unpacked_lun, data_length,
MSG_SIMPLE_TAG, data_dir, 0);
+ return;
+
+err:
+ req->status.status |= cpu_to_be32(
+ STATUS_BLOCK_RESP(STATUS_RESP_TRANSPORT_FAILURE) |
+ STATUS_BLOCK_DEAD(0) |
+ STATUS_BLOCK_LEN(1) |
+ STATUS_BLOCK_SBP_STATUS(SBP_STATUS_UNSPECIFIED_ERROR));
+ sbp_send_status(req);
+ sbp_free_request(req);
}
/*
--
1.7.10.4
next prev parent reply other threads:[~2012-07-16 18:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-16 18:04 [PATCH 0/7] series to fix qla2xxx use-after-free Roland Dreier
2012-07-16 18:04 ` [PATCH 1/7] qla2xxx: Get rid of redundant qla_tgt_sess.tearing_down Roland Dreier
2012-07-16 22:52 ` Nicholas A. Bellinger
2012-07-16 18:04 ` [PATCH 2/7] target: Un-export target_get_sess_cmd() Roland Dreier
2012-07-16 22:54 ` Nicholas A. Bellinger
2012-07-16 18:04 ` Roland Dreier [this message]
2012-07-16 22:55 ` [PATCH 3/7] sbp-target: Consolidate duplicated error path code in sbp_handle_command() Nicholas A. Bellinger
2012-07-16 18:04 ` [PATCH 4/7] target: Allow for target_submit_cmd() returning errors Roland Dreier
2012-07-16 23:00 ` Nicholas A. Bellinger
2012-07-16 23:05 ` Roland Dreier
2012-07-16 23:37 ` Nicholas A. Bellinger
2012-07-16 18:04 ` [PATCH 5/7] target: Check sess_tearing_down in target_get_sess_cmd() Roland Dreier
2012-07-16 23:08 ` Nicholas A. Bellinger
2012-07-16 23:21 ` Roland Dreier
2012-07-17 1:40 ` Roland Dreier
2012-07-17 1:56 ` Nicholas A. Bellinger
2012-07-17 1:59 ` Nicholas A. Bellinger
2012-07-17 16:34 ` Roland Dreier
2012-07-17 16:39 ` Christoph Hellwig
2012-07-17 19:28 ` Andy Grover
2012-07-17 23:24 ` Nicholas A. Bellinger
2012-07-16 18:04 ` [PATCH 6/7] qla2xxx: Remove racy, now-redundant check of sess_tearing_down Roland Dreier
2012-07-16 23:10 ` Nicholas A. Bellinger
2012-07-16 18:04 ` [PATCH 7/7] target: Remove se_session.sess_wait_list Roland Dreier
2012-07-16 23:15 ` 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=1342461882-5848-4-git-send-email-roland@kernel.org \
--to=roland@kernel.org \
--cc=bootc@bootc.net \
--cc=linux-scsi@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=stefanr@s5r6.in-berlin.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.