summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordmitry_yus <dmitry_yus@d7303112-9cec-0310-bdd2-e83a94d6c2b6>2005-03-11 03:14:13 +0000
committerdmitry_yus <dmitry_yus@d7303112-9cec-0310-bdd2-e83a94d6c2b6>2005-03-11 03:14:13 +0000
commit4710181e27a6dad9cca3b78cd80af8b4dae06c18 (patch)
tree84b9148facf5875bbf7ece471ade586c3f29c640
parente4f8cc5010dd59b68413369b8449c005eb36ff1a (diff)
downloadopen-iscsi-4710181e27a6dad9cca3b78cd80af8b4dae06c18.tar.gz
flush xmit queues on conn_stop(). so, after re-open queue will be empty.
git-svn-id: svn://svn.berlios.de/open-iscsi@175 d7303112-9cec-0310-bdd2-e83a94d6c2b6
-rw-r--r--TODO1
-rw-r--r--kernel/iscsi_tcp.c31
2 files changed, 32 insertions, 0 deletions
diff --git a/TODO b/TODO
index 0774ef7..47afa2a 100644
--- a/TODO
+++ b/TODO
@@ -35,3 +35,4 @@ fixme:
* daemon should manage its own ITT-space
* send_pdu() should use new "anon" poll of mtasks. the anon-mtask will be freed
right after its xmited
+* make InitiatorAlias configurable: see get_iscsi_initiatorname()
diff --git a/kernel/iscsi_tcp.c b/kernel/iscsi_tcp.c
index 11b585d..e6a59af 100644
--- a/kernel/iscsi_tcp.c
+++ b/kernel/iscsi_tcp.c
@@ -1593,6 +1593,9 @@ iscsi_data_xmit(struct iscsi_conn *conn)
* 1) in progress task
* 2) write responses, if any
* 3) new read/write requests
+ *
+ * Note: we don't need locking around __kfifo_get as long as
+ * we guarantie one producer and one consumer.
*/
/* process non-immediate(command) queue */
@@ -2143,10 +2146,38 @@ iscsi_conn_stop(iscsi_cnx_h cnxh, int flag)
if (flag == STOP_CNX_TERM || flag == STOP_CNX_RECOVER) {
BUG_ON(!conn->sock);
+
+ /*
+ * Socket must go now.
+ */
sock_hold(conn->sock->sk);
iscsi_conn_restore_callbacks(conn);
sock_put(conn->sock->sk);
sock_release(conn->sock);
+
+ /*
+ * flush xmit queues.
+ */
+ down(&conn->xmitsema);
+ while (__kfifo_get(conn->writequeue, (void*)&conn->ctask,
+ sizeof(void*)) ||
+ __kfifo_get(conn->xmitqueue, (void*)&conn->ctask,
+ sizeof(void*))) {
+ spin_lock_bh(&session->lock);
+ __kfifo_put(session->cmdpool.queue, (void*)&conn->ctask,
+ sizeof(void*));
+ spin_unlock_bh(&session->lock);
+ }
+ conn->ctask = NULL;
+ while (__kfifo_get(conn->immqueue, (void*)&conn->mtask,
+ sizeof(void*))) {
+ spin_lock_bh(&session->lock);
+ __kfifo_put(session->immpool.queue, (void*)&conn->mtask,
+ sizeof(void*));
+ spin_unlock_bh(&session->lock);
+ }
+ conn->mtask = NULL;
+ up(&conn->xmitsema);
}
}