Added timed wait to finish logo processing before doing
rest of the cleanup, ie, exches reset.

Signed-off-by: Vasu Dev <[email protected]>
---

 drivers/scsi/libfc/fc_lport.c |    7 +++++++
 include/scsi/libfc.h          |    2 ++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index b32b7a2..c252f3a 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -937,6 +937,8 @@ static void fc_lport_reset_locked(struct fc_lport *lport)
        if (lport->dns_rdata)
                lport->tt.rport_logoff(lport->dns_rdata);
 
+       init_completion(&lport->logo_done);
+
        if (lport->ptp_rdata) {
                lport->tt.rport_logoff(lport->ptp_rdata);
                kref_put(&lport->ptp_rdata->kref, lport->tt.rport_destroy);
@@ -946,6 +948,10 @@ static void fc_lport_reset_locked(struct fc_lport *lport)
                fc_lport_enter_logo(lport);
        }
 
+       wait_for_completion_timeout(&lport->logo_done,
+                                   msecs_to_jiffies(2 * lport->r_a_tov));
+
+
        lport->tt.exch_mgr_reset(lport, 0, 0);
        fc_host_fabric_name(lport->host) = 0;
 
@@ -1336,6 +1342,7 @@ void fc_lport_logo_resp(struct fc_seq *sp, struct 
fc_frame *fp,
        if (fp == ERR_PTR(-FC_EX_CLOSED))
                return;
 
+       complete(&lport->logo_done);
        mutex_lock(&lport->lp_mutex);
 
        if (IS_ERR(fp))
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index f53c8e3..c77a586 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -791,6 +791,7 @@ struct fc_disc {
  * @lp_mutex:              Mutex to protect the local port
  * @list:                  Handle for list of local ports
  * @retry_work:            Handle to local port for delayed retry context
+ * @logo_done:             Completion indicator for logout
  */
 struct fc_lport {
        /* Associations */
@@ -846,6 +847,7 @@ struct fc_lport {
        struct mutex                   lp_mutex;
        struct list_head               list;
        struct delayed_work            retry_work;
+       struct completion              logo_done;
 };
 
 /*

_______________________________________________
devel mailing list
[email protected]
https://lists.open-fcoe.org/mailman/listinfo/devel

Reply via email to