diff options
-rw-r--r-- | drivers/scsi/libiscsi.c | 25 |
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 | } |
579 | EXPORT_SYMBOL_GPL(iscsi_conn_failure); | 579 | EXPORT_SYMBOL_GPL(iscsi_conn_failure); |
580 | 580 | ||
581 | static 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 | } |