From: michaelc@cs.wisc.edu
To: linux-scsi@vger.kernel.org
Cc: Mike Christie <michaelc@cs.wisc.edu>
Subject: [PATCH 21/24] iscsi_tcp: hold lock during data rsp processing
Date: Thu, 13 Dec 2007 12:43:40 -0600 [thread overview]
Message-ID: <1197571453148-git-send-email-michaelc@cs.wisc.edu> (raw)
In-Reply-To: <1197571451503-git-send-email-michaelc@cs.wisc.edu>
From: Mike Christie <michaelc@cs.wisc.edu>
iscsi_data_rsp needs to hold the sesison lock when it calls
iscsi_update_cmdsn.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---
drivers/scsi/iscsi_tcp.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 84c4a50..edebdf2 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -641,13 +641,11 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
}
/* fill-in new R2T associated with the task */
- spin_lock(&session->lock);
iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr);
if (!ctask->sc || session->state != ISCSI_STATE_LOGGED_IN) {
printk(KERN_INFO "iscsi_tcp: dropping R2T itt %d in "
"recovery...\n", ctask->itt);
- spin_unlock(&session->lock);
return 0;
}
@@ -660,7 +658,6 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
printk(KERN_ERR "iscsi_tcp: invalid R2T with zero data len\n");
__kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t,
sizeof(void*));
- spin_unlock(&session->lock);
return ISCSI_ERR_DATALEN;
}
@@ -676,7 +673,6 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
r2t->data_offset, scsi_bufflen(ctask->sc));
__kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t,
sizeof(void*));
- spin_unlock(&session->lock);
return ISCSI_ERR_DATALEN;
}
@@ -690,8 +686,6 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
conn->r2t_pdus_cnt++;
iscsi_requeue_ctask(ctask);
- spin_unlock(&session->lock);
-
return 0;
}
@@ -764,7 +758,9 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
switch(opcode) {
case ISCSI_OP_SCSI_DATA_IN:
ctask = session->cmds[itt];
+ spin_lock(&conn->session->lock);
rc = iscsi_data_rsp(conn, ctask);
+ spin_unlock(&conn->session->lock);
if (rc)
return rc;
if (tcp_conn->in.datalen) {
@@ -806,9 +802,11 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
ctask = session->cmds[itt];
if (ahslen)
rc = ISCSI_ERR_AHSLEN;
- else if (ctask->sc->sc_data_direction == DMA_TO_DEVICE)
+ else if (ctask->sc->sc_data_direction == DMA_TO_DEVICE) {
+ spin_lock(&session->lock);
rc = iscsi_r2t_rsp(conn, ctask);
- else
+ spin_unlock(&session->lock);
+ } else
rc = ISCSI_ERR_PROTO;
break;
case ISCSI_OP_LOGIN_RSP:
--
1.5.1.2
next prev parent reply other threads:[~2007-12-13 18:44 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-13 18:43 RESEND: iscsi update for 2.6.25 michaelc
2007-12-13 18:43 ` [PATCH 01/24] libiscsi, iscsi_tcp: add device support michaelc
2007-12-13 18:43 ` [PATCH 02/24] iscsi_tcp: rewrite recv path michaelc
2007-12-13 18:43 ` [PATCH 03/24] Prettify resid handling and some extra checks michaelc
2007-12-13 18:43 ` [PATCH 04/24] iscsi_tcp, libiscsi: initial AHS Support michaelc
2007-12-13 18:43 ` [PATCH 05/24] iser patching for AHS support michaelc
2007-12-13 18:43 ` [PATCH 06/24] libiscsi, iscsi_tcp: iscsi pool cleanup michaelc
2007-12-13 18:43 ` [PATCH 07/24] libiscsi: do not block session during logout michaelc
2007-12-13 18:43 ` [PATCH 08/24] iscsi class: Use our own workq instead of common system one michaelc
2007-12-13 18:43 ` [PATCH 09/24] libiscsi: grab eh_mutex during host reset michaelc
2007-12-13 18:43 ` [PATCH 10/24] libiscsi: fix shutdown michaelc
2007-12-13 18:43 ` [PATCH 11/24] libiscsi: fix nop handling michaelc
2007-12-13 18:43 ` [PATCH 12/24] iscsi_tcp: update the website URL michaelc
2007-12-13 18:43 ` [PATCH 13/24] Do not fail commands immediately during logout michaelc
2007-12-13 18:43 ` [PATCH 14/24] clear conn->ctask when task is completed early michaelc
2007-12-13 18:43 ` [PATCH 15/24] Drop host lock in queuecommand michaelc
2007-12-13 18:43 ` [PATCH 16/24] convert xmit path to iscsi chunks michaelc
2007-12-13 18:43 ` [PATCH 17/24] iscsi_tcp: stop leaking r2t_info's when the incoming R2T is bad michaelc
2007-12-13 18:43 ` [PATCH 18/24] iscsi_tcp: drop session when itt does not match any command michaelc
2007-12-13 18:43 ` [PATCH 19/24] libiscsi, iscsi class: set tmf to a safe default and export in sysfs michaelc
2007-12-13 18:43 ` [PATCH 20/24] iscsi_tcp: enable sg chaining michaelc
2007-12-13 18:43 ` michaelc [this message]
2007-12-13 18:43 ` [PATCH 22/24] libiscsi: use is_power_of_2 michaelc
2007-12-13 18:43 ` [PATCH 23/24] iscsi_tcp: fix setting of r2t michaelc
2007-12-13 18:43 ` [PATCH 24/24] iscsi class: bump version michaelc
2007-12-16 10:09 ` [PATCH 20/24] iscsi_tcp: enable sg chaining Boaz Harrosh
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=1197571453148-git-send-email-michaelc@cs.wisc.edu \
--to=michaelc@cs.wisc.edu \
--cc=linux-scsi@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.