Skip to content

Commit f091fb8

Browse files
hreineckemartinkpetersen
authored andcommitted
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>
1 parent 675195d commit f091fb8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/scsi/scsi_transport_fc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2739,7 +2739,8 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
27392739

27402740
list_for_each_entry(rport, &fc_host->rports, peers) {
27412741

2742-
if ((rport->port_state == FC_PORTSTATE_BLOCKED) &&
2742+
if ((rport->port_state == FC_PORTSTATE_BLOCKED ||
2743+
rport->port_state == FC_PORTSTATE_NOTPRESENT) &&
27432744
(rport->channel == channel)) {
27442745

27452746
switch (fc_host->tgtid_bind_type) {

0 commit comments

Comments
 (0)