1. only call fc_rport_reject from fc_rport_error

2. Don't have fc_rport_reject check the LP state

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

 drivers/scsi/libfc/fc_rport.c |   71 ++++++++++++++++++-----------------------
 1 files changed, 31 insertions(+), 40 deletions(-)

diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 69ddb61..1aeff00 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -368,53 +368,41 @@ static void fc_rport_enter_ready(struct fc_rport *rport)
                rdata->event_callback(lport, rport, LPORT_EV_RPORT_CREATED);
 }
 
-/*
- * Handle exchange reject or retry exhaustion in various states.
+/**
+ * fc_rport_reject - Handle rejections when retries are exhausted
+ * @rport: The fc_rport that has failed
+ *
+ * Locking Note: The lock is expected to be held before calling
+ * this routine
  */
 static void fc_rport_reject(struct fc_rport *rport)
 {
-       struct fc_rport_libfc_priv *rp = rport->dd_data;
-       struct fc_lport *lp = rp->local_port;
-       switch (rp->rp_state) {
+       struct fc_rport_libfc_priv *rdata = rport->dd_data;
+       struct fc_lport *lport = rdata->local_port;
+
+       switch (rdata->rp_state) {
        case RPORT_ST_PLOGI:
        case RPORT_ST_PRLI:
-               fc_rport_state_enter(rport, RPORT_ST_ERROR);
-               if (rport == lp->dns_rp &&
-                   lp->state != LPORT_ST_RESET) {
-                       fc_lport_lock(lp);
-                       del_timer(&lp->state_timer);
-                       lp->dns_rp = NULL;
-                       if (lp->state == LPORT_ST_DNS_STOP) {
-                               fc_lport_unlock(lp);
-                               lp->tt.lport_logout(lp);
-                       } else {
-                               lp->tt.lport_login(lp);
-                               fc_lport_unlock(lp);
-                       }
-                       fc_remote_port_delete(rport);
-               }
+               if (fc_rp_debug)
+                       FC_DBG("remote %6x closed\n", rport->port_id);
+
+               if (rdata->event_callback)
+                       rdata->event_callback(lport, rport,
+                                             LPORT_EV_RPORT_FAILED);
+               fc_remote_port_delete(rport);
                break;
        case RPORT_ST_RTV:
                fc_rport_enter_ready(rport);
                break;
        case RPORT_ST_LOGO:
-               fc_rport_state_enter(rport, RPORT_ST_INIT);
                if (fc_rp_debug)
                        FC_DBG("remote %6x closed\n", rport->port_id);
-               if (rport == lp->dns_rp &&
-                   lp->state != LPORT_ST_RESET) {
-                       fc_lport_lock(lp);
-                       del_timer(&lp->state_timer);
-                       lp->dns_rp = NULL;
-                       if (lp->state == LPORT_ST_DNS_STOP) {
-                               fc_lport_unlock(lp);
-                               lp->tt.lport_logout(lp);
-                       } else {
-                               lp->tt.lport_login(lp);
-                               fc_lport_unlock(lp);
-                       }
-                       fc_remote_port_delete(rport);
-               }
+
+               if (rdata->event_callback)
+                       rdata->event_callback(lport, rport,
+                                             LPORT_EV_RPORT_FAILED);
+
+               fc_remote_port_delete(rport);
                break;
        case RPORT_ST_NONE:
        case RPORT_ST_READY:
@@ -427,8 +415,13 @@ static void fc_rport_reject(struct fc_rport *rport)
        return;
 }
 
-/*
- * Timeout handler for retrying after allocation failures or exchange timeout.
+/**
+ * fc_rport_timeout - Handler for the retry_work timer.
+ *  Simply determine what should be done next.
+ * @work: The work struct of the fc_rport_libfc_priv
+ *
+ * Locking Note: This is an action function so we grab the
+ * lock, call an _enter_* state and then unlock.
  */
 static void fc_rport_timeout(struct work_struct *work)
 {
@@ -534,9 +527,7 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct 
fc_frame *fp,
                        rjp = fc_frame_payload_get(fp, sizeof(*rjp));
                        if (op == ELS_LS_RJT && rjp != NULL &&
                            rjp->er_reason == ELS_RJT_INPROG)
-                               fc_rport_error(rport, fp);    /* try again */
-                       else
-                               fc_rport_reject(rport);   /* error */
+                               fc_rport_error(rport, fp);
                }
                fc_rport_unlock(rport);
                fc_frame_free(fp);

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

Reply via email to