Skip to contentSkip to conversation

scsi_transport_fc: set scsi_target_id upon rescan

PATCH Applied Hannes Reinecke 4 participants 4 messages Sep 20, 2017 – Sep 25, 2017 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi_transport_fc: set scsi_target_id upon rescan

From: Hannes Reinecke <[email protected]>

When an rport is found in the bindings array there is no guarantee that it had been a target port, so we need to call fc_remote_port_rolechg() here to ensure the scsi_target_id is set correctly. Otherwise the port will never be scanned.

---
 drivers/scsi/scsi_transport_fc.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/scsi/scsi_transport_fc.c +1 -10
index 3c6bc0081fcb..377961380fd7 100644
@@ -2876,7 +2876,6 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
 			memcpy(&rport->port_name, &ids->port_name,
 				sizeof(rport->port_name));
 			rport->port_id = ids->port_id;
-			rport->roles = ids->roles;
 			rport->port_state = FC_PORTSTATE_ONLINE;
 			rport->flags &= ~FC_RPORT_FAST_FAIL_TIMEDOUT;
 
@@ -2885,15 +2884,7 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
 						fci->f->dd_fcrport_size);
 			spin_unlock_irqrestore(shost->host_lock, flags);
 
-			if (ids->roles & FC_PORT_ROLE_FCP_TARGET) {
-				scsi_target_unblock(&rport->dev, SDEV_RUNNING);
-
-				/* initiate a scan of the target */
-				spin_lock_irqsave(shost->host_lock, flags);
-				rport->flags |= FC_RPORT_SCAN_PENDING;
-				scsi_queue_work(shost, &rport->scan_work);
-				spin_unlock_irqrestore(shost->host_lock, flags);
-			}
+			fc_remote_port_rolechg(rport, ids->roles);
 			return rport;
 		}
 	}
Signature · 1 line
2.12.3
Tested-by on v1 1/1
#2 lore raw
In reply to Hannes Reinecke
Quoted 7 lines · Hannes Reinecke

From: Hannes Reinecke <[email protected]>

When an rport is found in the bindings array there is no guarantee that it had been a target port, so we need to call fc_remote_port_rolechg() here to ensure the scsi_target_id is set correctly. Otherwise the port will never be scanned.

Quoted 5 lines
---
 drivers/scsi/scsi_transport_fc.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

Verified that port is scanned after applying this patch.

#3 lore raw
In reply to Hannes Reinecke

Hannes,

Quoted 4 lines

When an rport is found in the bindings array there is no guarantee that it had been a target port, so we need to call fc_remote_port_rolechg() here to ensure the scsi_target_id is set correctly. Otherwise the port will never be scanned.

Applied to 4.14/scsi-fixes. Thank you!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering