diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2007-02-28 18:32:16 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-03-11 12:26:05 -0400 |
commit | 05db888a46866fd4eae643792c162e1a5c1a8612 (patch) | |
tree | 19ebc2d112d318680b0e9cb34572d070ed571eff /drivers/scsi | |
parent | 779ea1207b6a43943faa44f41be7311263315604 (diff) |
[SCSI] libiscsi: clear mtask
Consolidate the mtask clearing code.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/libiscsi.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 6346a913c36e..0ad484f87b1d 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -577,7 +577,7 @@ void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err) | |||
577 | } | 577 | } |
578 | EXPORT_SYMBOL_GPL(iscsi_conn_failure); | 578 | EXPORT_SYMBOL_GPL(iscsi_conn_failure); |
579 | 579 | ||
580 | static int iscsi_xmit_imm_task(struct iscsi_conn *conn) | 580 | static int iscsi_xmit_mtask(struct iscsi_conn *conn) |
581 | { | 581 | { |
582 | struct iscsi_hdr *hdr = conn->mtask->hdr; | 582 | struct iscsi_hdr *hdr = conn->mtask->hdr; |
583 | int rc, was_logout = 0; | 583 | int rc, was_logout = 0; |
@@ -591,6 +591,9 @@ static int iscsi_xmit_imm_task(struct iscsi_conn *conn) | |||
591 | if (rc) | 591 | if (rc) |
592 | return rc; | 592 | return rc; |
593 | 593 | ||
594 | /* done with this in-progress mtask */ | ||
595 | conn->mtask = NULL; | ||
596 | |||
594 | if (was_logout) { | 597 | if (was_logout) { |
595 | set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); | 598 | set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); |
596 | return -ENODATA; | 599 | return -ENODATA; |
@@ -643,11 +646,9 @@ static int iscsi_data_xmit(struct iscsi_conn *conn) | |||
643 | conn->ctask = NULL; | 646 | conn->ctask = NULL; |
644 | } | 647 | } |
645 | if (conn->mtask) { | 648 | if (conn->mtask) { |
646 | rc = iscsi_xmit_imm_task(conn); | 649 | rc = iscsi_xmit_mtask(conn); |
647 | if (rc) | 650 | if (rc) |
648 | goto again; | 651 | goto again; |
649 | /* done with this in-progress mtask */ | ||
650 | conn->mtask = NULL; | ||
651 | } | 652 | } |
652 | 653 | ||
653 | /* process immediate first */ | 654 | /* process immediate first */ |
@@ -658,12 +659,10 @@ static int iscsi_data_xmit(struct iscsi_conn *conn) | |||
658 | list_add_tail(&conn->mtask->running, | 659 | list_add_tail(&conn->mtask->running, |
659 | &conn->mgmt_run_list); | 660 | &conn->mgmt_run_list); |
660 | spin_unlock_bh(&conn->session->lock); | 661 | spin_unlock_bh(&conn->session->lock); |
661 | rc = iscsi_xmit_imm_task(conn); | 662 | rc = iscsi_xmit_mtask(conn); |
662 | if (rc) | 663 | if (rc) |
663 | goto again; | 664 | goto again; |
664 | } | 665 | } |
665 | /* done with this mtask */ | ||
666 | conn->mtask = NULL; | ||
667 | } | 666 | } |
668 | 667 | ||
669 | /* process command queue */ | 668 | /* process command queue */ |
@@ -701,12 +700,10 @@ static int iscsi_data_xmit(struct iscsi_conn *conn) | |||
701 | list_add_tail(&conn->mtask->running, | 700 | list_add_tail(&conn->mtask->running, |
702 | &conn->mgmt_run_list); | 701 | &conn->mgmt_run_list); |
703 | spin_unlock_bh(&conn->session->lock); | 702 | spin_unlock_bh(&conn->session->lock); |
704 | rc = tt->xmit_mgmt_task(conn, conn->mtask); | 703 | rc = iscsi_xmit_mtask(conn); |
705 | if (rc) | 704 | if (rc) |
706 | goto again; | 705 | goto again; |
707 | } | 706 | } |
708 | /* done with this mtask */ | ||
709 | conn->mtask = NULL; | ||
710 | } | 707 | } |
711 | 708 | ||
712 | return -ENODATA; | 709 | return -ENODATA; |