[SCSI] libfc: have rport_create do a lookup for pre-existing rports first
authorJoe Eykholt <jeykholt@cisco.com>
Tue, 25 Aug 2009 21:01:55 +0000 (14:01 -0700)
committerJames Bottomley <James.Bottomley@suse.de>
Thu, 10 Sep 2009 17:07:46 +0000 (12:07 -0500)
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@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/libfc/fc_disc.c
drivers/scsi/libfc/fc_rport.c

index e6b13bfecf735b017bf0420c8158dd31a3fb716a..266aa1ea01e481f996c9b0dd2d61922aecefc23d 100644 (file)
@@ -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;
index a9087b31bce9190b53b59c4a8f857dbd44e71e1a..29bb6fd100360637cfeedb6cc0ee595ff4331658 100644 (file)
@@ -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;