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

Commit 0883e3b3 authored by Brian King's avatar Brian King Committed by James Bottomley
Browse files

[SCSI] ibmvfc: Fix rport relogin



The ibmvfc driver has a bug in its SCN handling. If it receives
an ELS event such asn an N-Port SCN event or an unsolicited PLOGI,
or any other SCN event which causes ibmvfc_reinit_host to be called,
it is possible that we will call fc_remote_port_add for a target
that already has an rport added, which can result in duplicate
rports getting created for the same targets. Fix this by calling
fc_remote_port_rolechg in this scenario instead to report any possible
role change that may have occurred.

Signed-off-by: default avatarBrian King <brking@linux.vnet.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent d4b17a20
Loading
Loading
Loading
Loading
+11 −1
Original line number Original line Diff line number Diff line
@@ -3263,6 +3263,7 @@ static int ibmvfc_alloc_target(struct ibmvfc_host *vhost, u64 scsi_id)
		return -ENOMEM;
		return -ENOMEM;
	}
	}


	memset(tgt, 0, sizeof(*tgt));
	tgt->scsi_id = scsi_id;
	tgt->scsi_id = scsi_id;
	tgt->new_scsi_id = scsi_id;
	tgt->new_scsi_id = scsi_id;
	tgt->vhost = vhost;
	tgt->vhost = vhost;
@@ -3573,9 +3574,18 @@ static void ibmvfc_log_ae(struct ibmvfc_host *vhost, int events)
static void ibmvfc_tgt_add_rport(struct ibmvfc_target *tgt)
static void ibmvfc_tgt_add_rport(struct ibmvfc_target *tgt)
{
{
	struct ibmvfc_host *vhost = tgt->vhost;
	struct ibmvfc_host *vhost = tgt->vhost;
	struct fc_rport *rport;
	struct fc_rport *rport = tgt->rport;
	unsigned long flags;
	unsigned long flags;


	if (rport) {
		tgt_dbg(tgt, "Setting rport roles\n");
		fc_remote_port_rolechg(rport, tgt->ids.roles);
		spin_lock_irqsave(vhost->host->host_lock, flags);
		ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE);
		spin_unlock_irqrestore(vhost->host->host_lock, flags);
		return;
	}

	tgt_dbg(tgt, "Adding rport\n");
	tgt_dbg(tgt, "Adding rport\n");
	rport = fc_remote_port_add(vhost->host, 0, &tgt->ids);
	rport = fc_remote_port_add(vhost->host, 0, &tgt->ids);
	spin_lock_irqsave(vhost->host->host_lock, flags);
	spin_lock_irqsave(vhost->host->host_lock, flags);