scsi_transport_fc: Also check for NOTPRESENT in fc_remote_port_add()
PATCH 1/1 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.
--- drivers/scsi/scsi_transport_fc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/scsi_transport_fc.c +2 -1
@@ -2739,7 +2739,8 @@ struct fc_rport *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) {
Signature · 1 line
1.8.5.6
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Martin K. Petersen
AppliedHannes,
Quoted 6 lines
During failover there is a small race window between
fc_remote_port_add()andfc_timeout_deleted_rport(); the latter drops the lock after setting the port to NOTPRESENT, so iffc_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.
Applied to 4.14/scsi-fixes. Thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering