aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_transport_fc.c
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2017-09-25 13:47:23 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2017-09-25 21:34:09 -0400
commitf091fb8c344ce13cbf058d304c6cbb042be97058 (patch)
tree41b1c42cf87d135bb2a1ce1ea1d043fc53ac0cc4 /drivers/scsi/scsi_transport_fc.c
parentscsi: scsi_transport_fc: set scsi_target_id upon rescan (diff)
downloadlinux-dev-f091fb8c344ce13cbf058d304c6cbb042be97058.tar.xz
linux-dev-f091fb8c344ce13cbf058d304c6cbb042be97058.zip
scsi: scsi_transport_fc: Also check for NOTPRESENT in fc_remote_port_add()
During failover there is a small race window between fc_remote_port_add() and fc_timeout_deleted_rport(); the latter drops the lock after setting the port to NOTPRESENT, so if fc_remote_port_add() is called right at that time it will fail to detect the existing rport and happily adding a new structure, causing rports to get registered twice. Signed-off-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_fc.c')
-rw-r--r--drivers/scsi/scsi_transport_fc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index e74fffc32c75..cbd4495d0ff9 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -2739,7 +2739,8 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
list_for_each_entry(rport, &fc_host->rports, peers) {
- if ((rport->port_state == FC_PORTSTATE_BLOCKED) &&
+ if ((rport->port_state == FC_PORTSTATE_BLOCKED ||
+ rport->port_state == FC_PORTSTATE_NOTPRESENT) &&
(rport->channel == channel)) {
switch (fc_host->tgtid_bind_type) {