1 Subject: Fix rport relogin
2 From: Brian King <brking@linux.vnet.ibm.com>
3 References: 472645 - LTC51429
5 The ibmvfc driver has a bug in its SCN handling. If it receives
6 an ELS event such asn an N-Port SCN event or an unsolicited PLOGI,
7 or any other SCN event which causes ibmvfc_reinit_host to be called,
8 it is possible that we will call fc_remote_port_add for a target
9 that already has an rport added, which can result in duplicate
10 rports getting created for the same targets. Fix this by calling
11 fc_remote_port_rolechg in this scenario instead to report any possible
12 role change that may have occurred.
14 Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
15 Signed-off-by: Olaf Hering <olh@suse.de>
18 drivers/scsi/ibmvscsi/ibmvfc.c | 12 +++++++++++-
19 1 file changed, 11 insertions(+), 1 deletion(-)
21 --- a/drivers/scsi/ibmvscsi/ibmvfc.c
22 +++ b/drivers/scsi/ibmvscsi/ibmvfc.c
23 @@ -3315,6 +3315,7 @@ static int ibmvfc_alloc_target(struct ib
27 + memset(tgt, 0, sizeof(*tgt));
28 tgt->scsi_id = scsi_id;
29 tgt->new_scsi_id = scsi_id;
31 @@ -3625,9 +3626,18 @@ static void ibmvfc_log_ae(struct ibmvfc_
32 static void ibmvfc_tgt_add_rport(struct ibmvfc_target *tgt)
34 struct ibmvfc_host *vhost = tgt->vhost;
35 - struct fc_rport *rport;
36 + struct fc_rport *rport = tgt->rport;
40 + tgt_dbg(tgt, "Setting rport roles\n");
41 + fc_remote_port_rolechg(rport, tgt->ids.roles);
42 + spin_lock_irqsave(vhost->host->host_lock, flags);
43 + ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE);
44 + spin_unlock_irqrestore(vhost->host->host_lock, flags);
48 tgt_dbg(tgt, "Adding rport\n");
49 rport = fc_remote_port_add(vhost->host, 0, &tgt->ids);
50 spin_lock_irqsave(vhost->host->host_lock, flags);