[Open-FCoE] [RFC PATCH 12/13] libfc: Ensure rports are deleted for RSCN

Robert Love robert.w.love at intel.com
Thu Oct 30 18:21:39 UTC 2008


Currently we don't delete rports from our list when we re-discovery.
This creates multipe rports since we add a new one to the list for one
that was never removed. This patch ensures that we're deleting rports
before re-discovering them.

Signed-off-by: Robert Love <robert.w.love at intel.com>
---

 drivers/scsi/libfc/fc_disc.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index 1b267cb..5a640c8 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -219,6 +219,8 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp,
 				  struct fc_disc *disc)
 {
 	struct fc_lport *lport;
+	struct fc_rport *rport;
+	struct fc_rport_libfc_priv *rdata;
 	struct fc_els_rscn *rp;
 	struct fc_els_rscn_page *pp;
 	struct fc_seq_els_data rjt_data;
@@ -283,6 +285,12 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp,
 		FC_DEBUG_DISC("RSCN received: rediscovering\n");
 		list_for_each_entry_safe(dp, next, &disc_ports, peers) {
 			list_del(&dp->peers);
+			rport = lport->tt.rport_lookup(lport, dp->ids.port_id);
+			if (rport) {
+				rdata = RPORT_TO_PRIV(rport);
+				list_del(&rdata->peers);
+				lport->tt.rport_stop(rport);
+			}
 			kfree(dp);
 		}
 		fc_disc_restart(disc);
@@ -292,6 +300,9 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp,
 			      redisc, lport->state, disc->pending);
 		list_for_each_entry_safe(dp, next, &disc_ports, peers) {
 			list_del(&dp->peers);
+			rport = lport->tt.rport_lookup(lport, dp->ids.port_id);
+			if (rport)
+				lport->tt.rport_stop(rport);
 			fc_disc_single(disc, dp);
 		}
 	}




More information about the devel mailing list