libfc: Fix BUG() when retrying PLOGI.

kernel BUG at drivers/scsi/libfc/fc_rport.c:410

    It's possible to be in fc_rport_retry() after a retry timeout scheduled
    when we were attempting PLOGI.  In the meantime, the remote port may have
    sent a PLOGI and/or PRLI, which made us READY.  Don't BUG() if the state
    is not as expected.

    Signed-off-by: Joe Eykholt <[EMAIL PROTECTED]>

Signed-off-by: Joe Eykholt <[EMAIL PROTECTED]>
---
 drivers/scsi/libfc/fc_rport.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)


diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index cd559dd..e87d980 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -401,13 +401,19 @@ static void fc_rport_reject(struct fc_rport *rport)
                        fc_remote_port_delete(rport);
                }
                break;
-       case RPORT_ST_NONE:
+       /*
+        * We can be here if a PLOGI got retried, but before this we
+        * received and accepted a PLOGI and/or PRLI from the remote.
+        */
        case RPORT_ST_READY:
-       case RPORT_ST_ERROR:
        case RPORT_ST_PLOGI_RECV:
+               break;
+       case RPORT_ST_NONE:
+       case RPORT_ST_ERROR:
        case RPORT_ST_STARTED:
        case RPORT_ST_INIT:
-               BUG();
+               FC_DBG("unexpected state %d rport %6.6x\n",
+                       rp->rp_state, rport->port_id);
                break;
        }
        return;
@@ -438,9 +444,9 @@ static void fc_rport_timeout(struct work_struct *work)
        case RPORT_ST_READY:
        case RPORT_ST_ERROR:
        case RPORT_ST_INIT:
+       case RPORT_ST_PLOGI_RECV:
                break;
        case RPORT_ST_NONE:
-       case RPORT_ST_PLOGI_RECV:
        case RPORT_ST_STARTED:
                BUG();
                break;


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

Reply via email to