Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19f97e3c authored by Joe Eykholt's avatar Joe Eykholt Committed by James Bottomley
Browse files

[SCSI] libfc: have rport_create do a lookup for pre-existing rports first



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: default avatarJoe Eykholt <jeykholt@cisco.com>
Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 48f00902
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -376,14 +376,11 @@ static int fc_disc_new_target(struct fc_disc *disc,
	if (((ids->port_name != -1) || (ids->port_id != -1)) &&
	    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;
		}
		}
		if (rdata) {
			rdata->ops = &fc_disc_rport_ops;
			lport->tt.rport_login(rdata);
+4 −0
Original line number Diff line number Diff line
@@ -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;