All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi_transport_fc: set scsi_target_id upon rescan
@ 2017-09-20  6:58 Hannes Reinecke
  2017-09-20 10:32 ` Johannes Thumshirn
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hannes Reinecke @ 2017-09-20  6:58 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Smart, James Bottomley, linux-scsi,
	Hannes Reinecke

From: Hannes Reinecke <hare@suse.com>

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.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/scsi_transport_fc.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 3c6bc0081fcb..377961380fd7 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -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;
 		}
 	}
-- 
2.12.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi_transport_fc: set scsi_target_id upon rescan
  2017-09-20  6:58 [PATCH] scsi_transport_fc: set scsi_target_id upon rescan Hannes Reinecke
@ 2017-09-20 10:32 ` Johannes Thumshirn
  2017-09-20 13:12 ` Chad Dupuis
  2017-09-25 23:00 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2017-09-20 10:32 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, James Smart,
	James Bottomley, linux-scsi, Hannes Reinecke

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi_transport_fc: set scsi_target_id upon rescan
  2017-09-20  6:58 [PATCH] scsi_transport_fc: set scsi_target_id upon rescan Hannes Reinecke
  2017-09-20 10:32 ` Johannes Thumshirn
@ 2017-09-20 13:12 ` Chad Dupuis
  2017-09-25 23:00 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Chad Dupuis @ 2017-09-20 13:12 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, James Smart,
	James Bottomley, linux-scsi, Hannes Reinecke


On Wed, 20 Sep 2017, 2:58am, Hannes Reinecke wrote:

> From: Hannes Reinecke <hare@suse.com>
> 
> 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.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.com>
> ---
>  drivers/scsi/scsi_transport_fc.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 

Verified that port is scanned after applying this patch.

Tested-by: Chad Dupuis <chad.dupuis@cavium.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi_transport_fc: set scsi_target_id upon rescan
  2017-09-20  6:58 [PATCH] scsi_transport_fc: set scsi_target_id upon rescan Hannes Reinecke
  2017-09-20 10:32 ` Johannes Thumshirn
  2017-09-20 13:12 ` Chad Dupuis
@ 2017-09-25 23:00 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2017-09-25 23:00 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, James Smart,
	James Bottomley, linux-scsi, Hannes Reinecke


Hannes,

> 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!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-25 23:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-20  6:58 [PATCH] scsi_transport_fc: set scsi_target_id upon rescan Hannes Reinecke
2017-09-20 10:32 ` Johannes Thumshirn
2017-09-20 13:12 ` Chad Dupuis
2017-09-25 23:00 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.