We need to lock the state_lock before calling the fc_lport_enter_reset
function.

Signed-off-by: Robert Love <[EMAIL PROTECTED]>
---

 drivers/scsi/fcoe/fcoeinit.c  |    2 +-
 drivers/scsi/libfc/fc_fcp.c   |    3 ++-
 drivers/scsi/libfc/fc_lport.c |   16 ++++++++++++----
 include/scsi/libfc/libfc.h    |    4 ++--
 4 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoeinit.c b/drivers/scsi/fcoe/fcoeinit.c
index ac98159..0705dfc 100644
--- a/drivers/scsi/fcoe/fcoeinit.c
+++ b/drivers/scsi/fcoe/fcoeinit.c
@@ -54,7 +54,7 @@ struct scsi_transport_template *fcoe_transport_template;
 static int fcoe_reset(struct Scsi_Host *shost)
 {
        struct fc_lport *lp = shost_priv(shost);
-       fc_lport_enter_reset(lp);
+       fc_lport_reset(lp);
        return 0;
 }
 
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 7243ac2..7a95f62 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -2005,7 +2005,8 @@ int fc_eh_host_reset(struct scsi_cmnd *sc_cmd)
        struct fc_lport *lp;
 
        lp = shost_priv(sc_cmd->device->host);
-       return lp->tt.lport_reset(lp) ? FAILED : SUCCESS;
+       lp->tt.lport_reset(lp);
+       return SUCCESS;
 }
 EXPORT_SYMBOL(fc_eh_host_reset);
 
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index f9c4075..bdffb3a 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -36,6 +36,7 @@
 
 static int fc_lport_debug;
 
+static void fc_lport_enter_reset(struct fc_lport *);
 static void fc_lport_enter_flogi(struct fc_lport *);
 static void fc_lport_enter_dns(struct fc_lport *);
 static void fc_lport_enter_dns_stop(struct fc_lport *);
@@ -763,12 +764,21 @@ static void fc_lport_recv(struct fc_lport *lp, struct 
fc_seq *sp,
        lp->tt.exch_done(sp);
 }
 
+void fc_lport_reset(struct fc_lport *lp)
+{
+       fc_lport_lock(lp);
+       fc_lport_enter_reset(lp);
+       fc_lport_unlock(lp);
+}
+EXPORT_SYMBOL(fc_lport_reset);
+
+
 /*
  * Put the local port back into the initial state.  Reset all sessions.
  * This is called after a SCSI reset or the driver is unloading
  * or the program is exiting.
  */
-int fc_lport_enter_reset(struct fc_lport *lp)
+static void fc_lport_enter_reset(struct fc_lport *lp)
 {
        if (fc_lport_debug)
                FC_DBG("Processing RESET state");
@@ -790,9 +800,7 @@ int fc_lport_enter_reset(struct fc_lport *lp)
        fc_lport_set_fid(lp, 0);
        if ((lp->link_status & FC_LINK_UP) == FC_LINK_UP)
                fc_lport_enter_flogi(lp);
-       return 0;
 }
-EXPORT_SYMBOL(fc_lport_enter_reset);
 
 /*
  * Handle errors on local port requests.
@@ -1202,7 +1210,7 @@ int fc_lport_init(struct fc_lport *lp)
                lp->tt.lport_recv = fc_lport_recv;
 
        if (!lp->tt.lport_reset)
-               lp->tt.lport_reset = fc_lport_enter_reset;
+               lp->tt.lport_reset = fc_lport_reset;
 
        if (!lp->tt.lport_event_callback)
                lp->tt.lport_event_callback = fc_lport_event_callback;
diff --git a/include/scsi/libfc/libfc.h b/include/scsi/libfc/libfc.h
index 8af6e56..016defe 100644
--- a/include/scsi/libfc/libfc.h
+++ b/include/scsi/libfc/libfc.h
@@ -330,7 +330,7 @@ struct libfc_function_template {
        void (*lport_recv)(struct fc_lport *lp, struct fc_seq *sp,
                           struct fc_frame *fp);
 
-       int (*lport_reset)(struct fc_lport *);
+       void (*lport_reset)(struct fc_lport *);
        int (*lport_event_callback)(struct fc_lport *, struct fc_rport *,
                                    enum fc_lport_event);
 
@@ -564,7 +564,7 @@ int fc_lport_config(struct fc_lport *);
 /*
  * Reset the local port.
  */
-int fc_lport_enter_reset(struct fc_lport *);
+void fc_lport_reset(struct fc_lport *);
 
 /*
  * Set the mfs or reset

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

Reply via email to