aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ibmvscsi/ibmvfc.c
diff options
context:
space:
mode:
authorBrian King <brking@linux.vnet.ibm.com>2009-02-04 17:13:12 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-02-10 11:15:18 -0500
commit0883e3b3a85b5860b7729f1279a52e95b87dea97 (patch)
treeb31b0b01588b2927799861bf7a2c7032f7607c6b /drivers/scsi/ibmvscsi/ibmvfc.c
parentd4b17a20f30faf0debbc225bfbf98dba4e351c4d (diff)
[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: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/ibmvscsi/ibmvfc.c')
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 41226e3a741f..ed1e728763a2 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -3263,6 +3263,7 @@ static int ibmvfc_alloc_target(struct ibmvfc_host *vhost, u64 scsi_id)
3263 return -ENOMEM; 3263 return -ENOMEM;
3264 } 3264 }
3265 3265
3266 memset(tgt, 0, sizeof(*tgt));
3266 tgt->scsi_id = scsi_id; 3267 tgt->scsi_id = scsi_id;
3267 tgt->new_scsi_id = scsi_id; 3268 tgt->new_scsi_id = scsi_id;
3268 tgt->vhost = vhost; 3269 tgt->vhost = vhost;
@@ -3573,9 +3574,18 @@ static void ibmvfc_log_ae(struct ibmvfc_host *vhost, int events)
3573static void ibmvfc_tgt_add_rport(struct ibmvfc_target *tgt) 3574static void ibmvfc_tgt_add_rport(struct ibmvfc_target *tgt)
3574{ 3575{
3575 struct ibmvfc_host *vhost = tgt->vhost; 3576 struct ibmvfc_host *vhost = tgt->vhost;
3576 struct fc_rport *rport; 3577 struct fc_rport *rport = tgt->rport;
3577 unsigned long flags; 3578 unsigned long flags;
3578 3579
3580 if (rport) {
3581 tgt_dbg(tgt, "Setting rport roles\n");
3582 fc_remote_port_rolechg(rport, tgt->ids.roles);
3583 spin_lock_irqsave(vhost->host->host_lock, flags);
3584 ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE);
3585 spin_unlock_irqrestore(vhost->host->host_lock, flags);
3586 return;
3587 }
3588
3579 tgt_dbg(tgt, "Adding rport\n"); 3589 tgt_dbg(tgt, "Adding rport\n");
3580 rport = fc_remote_port_add(vhost->host, 0, &tgt->ids); 3590 rport = fc_remote_port_add(vhost->host, 0, &tgt->ids);
3581 spin_lock_irqsave(vhost->host->host_lock, flags); 3591 spin_lock_irqsave(vhost->host->host_lock, flags);