[PATCH 39/64] libfc: have rport_create do a lookup for pre-existing rports first

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Joe Eykholt <jeykholt@xxxxxxxxx>

For future discovery patches, change rport_create to return a previously
created rport_priv that has the FC_ID as long as it isn't in deleted state.

Signed-off-by: Joe Eykholt <jeykholt@xxxxxxxxx>
Signed-off-by: Robert Love <robert.w.love@xxxxxxxxx>
---

 drivers/scsi/libfc/fc_disc.c  |    9 +++------
 drivers/scsi/libfc/fc_rport.c |    4 ++++
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index e6b13bf..266aa1e 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -377,12 +377,9 @@ static int fc_disc_new_target(struct fc_disc *disc,
 	    ids->port_id != fc_host_port_id(lport->host) &&
 	    ids->port_name != lport->wwpn) {
 		if (!rdata) {
-			rdata = lport->tt.rport_lookup(lport, ids->port_id);
-			if (!rdata) {
-				rdata = lport->tt.rport_create(lport, ids);
-				if (!rdata)
-					error = -ENOMEM;
-			}
+			rdata = lport->tt.rport_create(lport, ids);
+			if (!rdata)
+				error = -ENOMEM;
 		}
 		if (rdata) {
 			rdata->ops = &fc_disc_rport_ops;
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index a9087b3..29bb6fd 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -98,6 +98,10 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
 {
 	struct fc_rport_priv *rdata;
 
+	rdata = lport->tt.rport_lookup(lport, ids->port_id);
+	if (rdata)
+		return rdata;
+
 	rdata = kzalloc(sizeof(*rdata), GFP_KERNEL);
 	if (!rdata)
 		return NULL;

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux