aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libiscsi.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2006-10-16 18:09:42 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-10-25 18:14:05 -0400
commitb5072ea0910e5c8c79b8313e0ef70ca763983dbf (patch)
tree518228880851f5067553543bca314fa96436168d /drivers/scsi/libiscsi.c
parent5831c737f724aa6a655a908d202221f079f30036 (diff)
[SCSI] libiscsi: fix logout pdu processing
According to the iscsi RFC, we cannot send other requests if we have sent a logout pdu. This patch enforces this requirement by blocking the session and suspending the send thread. Userspace decides if we restart the connection or if we just free everything. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/libiscsi.c')
-rw-r--r--drivers/scsi/libiscsi.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index f5a9560b357f..2865ebd557ef 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -578,6 +578,27 @@ void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err)
578} 578}
579EXPORT_SYMBOL_GPL(iscsi_conn_failure); 579EXPORT_SYMBOL_GPL(iscsi_conn_failure);
580 580
581static int iscsi_xmit_imm_task(struct iscsi_conn *conn)
582{
583 struct iscsi_hdr *hdr = conn->mtask->hdr;
584 int rc, was_logout = 0;
585
586 if ((hdr->opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGOUT) {
587 conn->session->state = ISCSI_STATE_IN_RECOVERY;
588 iscsi_block_session(session_to_cls(conn->session));
589 was_logout = 1;
590 }
591 rc = conn->session->tt->xmit_mgmt_task(conn, conn->mtask);
592 if (rc)
593 return rc;
594
595 if (was_logout) {
596 set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
597 return -ENODATA;
598 }
599 return 0;
600}
601
581/** 602/**
582 * iscsi_data_xmit - xmit any command into the scheduled connection 603 * iscsi_data_xmit - xmit any command into the scheduled connection
583 * @conn: iscsi connection 604 * @conn: iscsi connection
@@ -623,7 +644,7 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
623 conn->ctask = NULL; 644 conn->ctask = NULL;
624 } 645 }
625 if (conn->mtask) { 646 if (conn->mtask) {
626 rc = tt->xmit_mgmt_task(conn, conn->mtask); 647 rc = iscsi_xmit_imm_task(conn);
627 if (rc) 648 if (rc)
628 goto again; 649 goto again;
629 /* done with this in-progress mtask */ 650 /* done with this in-progress mtask */
@@ -638,7 +659,7 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
638 list_add_tail(&conn->mtask->running, 659 list_add_tail(&conn->mtask->running,
639 &conn->mgmt_run_list); 660 &conn->mgmt_run_list);
640 spin_unlock_bh(&conn->session->lock); 661 spin_unlock_bh(&conn->session->lock);
641 rc = tt->xmit_mgmt_task(conn, conn->mtask); 662 rc = iscsi_xmit_imm_task(conn);
642 if (rc) 663 if (rc)
643 goto again; 664 goto again;
644 } 665 }