scsi: libfc: Do not login if the port is already started
authorHannes Reinecke <hare@suse.de>
Fri, 30 Sep 2016 09:01:18 +0000 (11:01 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 8 Nov 2016 22:29:47 +0000 (17:29 -0500)
When the port is already started we don't need to login; that
will only confuse the state machine.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/libfc/fc_rport.c

index 4e4087a0083673e5c9f989c961a37e18a009ed58..72a7183fdd06d8243b8f42ca824461aba74a34b2 100644 (file)
@@ -418,6 +418,12 @@ static int fc_rport_login(struct fc_rport_priv *rdata)
 {
        mutex_lock(&rdata->rp_mutex);
 
+       if (rdata->flags & FC_RP_STARTED) {
+               FC_RPORT_DBG(rdata, "port already started\n");
+               mutex_unlock(&rdata->rp_mutex);
+               return 0;
+       }
+
        rdata->flags |= FC_RP_STARTED;
        switch (rdata->rp_state) {
        case RPORT_ST_READY: