Re: [PATCH v2 1/8] qla2xxx: kill sessions/log out initiator on RSCN and port down events

2015-07-27 Thread Hannes Reinecke
On 07/27/2015 08:09 PM, Roland Dreier wrote:
 On Mon, Jul 27, 2015 at 1:09 AM, Hannes Reinecke h...@suse.de wrote:
 Hmm? What happened to the original FIXME?
 Is it not required anymore?
 
 Not sure I follow the question.  The original FIXME was /* FIXME:
 Re-enable Global event handling.. */ and this patch indeed re-enables
 global event handling.  I don't think it's a separate patch, it's all
 part of the same work.
 
 Unless I'm misunderstanding...
 
No, not really.
If the patch indeed enables global event handling everything's fine.
Wasn't just not quite obvious from the description nor the patch itself.

So:

Reviewed-by: Hannes Reinecke h...@suse.com

Cheers,

Hannes
-- 
Dr. Hannes ReineckezSeries  Storage
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/8] qla2xxx: kill sessions/log out initiator on RSCN and port down events

2015-07-27 Thread Roland Dreier
On Mon, Jul 27, 2015 at 1:09 AM, Hannes Reinecke h...@suse.de wrote:
 Hmm? What happened to the original FIXME?
 Is it not required anymore?

Not sure I follow the question.  The original FIXME was /* FIXME:
Re-enable Global event handling.. */ and this patch indeed re-enables
global event handling.  I don't think it's a separate patch, it's all
part of the same work.

Unless I'm misunderstanding...
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/8] qla2xxx: kill sessions/log out initiator on RSCN and port down events

2015-07-27 Thread Hannes Reinecke
On 07/14/2015 10:00 PM, Himanshu Madhani wrote:
 From: Roland Dreier rol...@purestorage.com
 
 To fix some issues talking to ESX, this patch modifies the qla2xxx driver
 so that it never logs into remote ports.  This has the side effect of
 getting rid of the rports entirely, which means we never log out of
 initiators and never tear down sessions when an initiator goes away.
 
 This is mostly OK, except that we can run into trouble if we have
 initiator A assigned FC address X:Y:Z by the fabric talking to us, and
 then initiator A goes away.  Some time (could be a long time) later,
 initiator B comes along and also gets FC address X:Y:Z (which is
 available again, because initiator A is gone).  If initiator B starts
 talking to us, then we'll still have the session for initiator A, and
 since we look up incoming IO based on the FC address X:Y:Z, initiator B
 will end up using ACLs for initiator A.
 
 Fix this by:
 
  1. Handling RSCN events somewhat differently; instead of completely
 skipping the processing of fcports, we look through the list, and if
 an fcport disappears, we tell the target code the tear down the
 session and tell the HBA FW to release the N_Port handle.
 
  2. Handling port down events by flushing all of our sessions.  The
 firmware was already releasing the N_Port handle but we want the
 target code to drop all the sessions too.
 
 Cc: sta...@vger.kernel.org
 Signed-off-by: Roland Dreier rol...@purestorage.com
 Signed-off-by: Alexei Potashnik ale...@purestorage.com
 Acked-by: Quinn Tran quinn.t...@qlogic.com
 Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com
 ---
  drivers/scsi/qla2xxx/qla_dbg.c|2 +-
  drivers/scsi/qla2xxx/qla_init.c   |  137 
 ++---
  drivers/scsi/qla2xxx/qla_target.c |9 ++-
  3 files changed, 117 insertions(+), 31 deletions(-)
 
 diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
 index 0e6ee3c..e9ae6b9 100644
 --- a/drivers/scsi/qla2xxx/qla_dbg.c
 +++ b/drivers/scsi/qla2xxx/qla_dbg.c
 @@ -68,7 +68,7 @@
   * |  || 0xd101-0xd1fe   
 |
   * |  || 0xd214-0xd2fe   
 |
   * | Target Mode   |   0xe079   ||
 - * | Target Mode Management|   0xf072   | 0xf002 |
 + * | Target Mode Management|   0xf080   | 0xf002 |
   * |  || 0xf046-0xf049  |
   * | Target Mode Task Management  |0x1000b  ||
   * --
 diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
 index 766fdfc..4895a4a 100644
 --- a/drivers/scsi/qla2xxx/qla_init.c
 +++ b/drivers/scsi/qla2xxx/qla_init.c
 @@ -3462,20 +3462,43 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
   if ((fcport-flags  FCF_FABRIC_DEVICE) == 0)
   continue;
  
 - if (fcport-scan_state == QLA_FCPORT_SCAN 
 - atomic_read(fcport-state) == FCS_ONLINE) {
 - qla2x00_mark_device_lost(vha, fcport,
 - ql2xplogiabsentdevice, 0);
 - if (fcport-loop_id != FC_NO_LOOP_ID 
 - (fcport-flags  FCF_FCP2_DEVICE) == 0 
 - fcport-port_type != FCT_INITIATOR 
 - fcport-port_type != FCT_BROADCAST) {
 - ha-isp_ops-fabric_logout(vha,
 - fcport-loop_id,
 - fcport-d_id.b.domain,
 - fcport-d_id.b.area,
 - fcport-d_id.b.al_pa);
 - qla2x00_clear_loop_id(fcport);
 + if (fcport-scan_state == QLA_FCPORT_SCAN) {
 + if (qla_ini_mode_enabled(base_vha) 
 + atomic_read(fcport-state) == FCS_ONLINE) {
 + qla2x00_mark_device_lost(vha, fcport,
 + ql2xplogiabsentdevice, 0);
 + if (fcport-loop_id != FC_NO_LOOP_ID 
 + (fcport-flags  FCF_FCP2_DEVICE) 
 == 0 
 + fcport-port_type != FCT_INITIATOR 
 
 + fcport-port_type != FCT_BROADCAST) 
 {
 + ha-isp_ops-fabric_logout(vha,
 + fcport-loop_id,
 + fcport-d_id.b.domain,
 + fcport-d_id.b.area,
 +

[PATCH v2 1/8] qla2xxx: kill sessions/log out initiator on RSCN and port down events

2015-07-14 Thread Himanshu Madhani
From: Roland Dreier rol...@purestorage.com

To fix some issues talking to ESX, this patch modifies the qla2xxx driver
so that it never logs into remote ports.  This has the side effect of
getting rid of the rports entirely, which means we never log out of
initiators and never tear down sessions when an initiator goes away.

This is mostly OK, except that we can run into trouble if we have
initiator A assigned FC address X:Y:Z by the fabric talking to us, and
then initiator A goes away.  Some time (could be a long time) later,
initiator B comes along and also gets FC address X:Y:Z (which is
available again, because initiator A is gone).  If initiator B starts
talking to us, then we'll still have the session for initiator A, and
since we look up incoming IO based on the FC address X:Y:Z, initiator B
will end up using ACLs for initiator A.

Fix this by:

 1. Handling RSCN events somewhat differently; instead of completely
skipping the processing of fcports, we look through the list, and if
an fcport disappears, we tell the target code the tear down the
session and tell the HBA FW to release the N_Port handle.

 2. Handling port down events by flushing all of our sessions.  The
firmware was already releasing the N_Port handle but we want the
target code to drop all the sessions too.

Cc: sta...@vger.kernel.org
Signed-off-by: Roland Dreier rol...@purestorage.com
Signed-off-by: Alexei Potashnik ale...@purestorage.com
Acked-by: Quinn Tran quinn.t...@qlogic.com
Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com
---
 drivers/scsi/qla2xxx/qla_dbg.c|2 +-
 drivers/scsi/qla2xxx/qla_init.c   |  137 ++---
 drivers/scsi/qla2xxx/qla_target.c |9 ++-
 3 files changed, 117 insertions(+), 31 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 0e6ee3c..e9ae6b9 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -68,7 +68,7 @@
  * |  || 0xd101-0xd1fe |
  * |  || 0xd214-0xd2fe |
  * | Target Mode |   0xe079   ||
- * | Target Mode Management  |   0xf072   | 0xf002 |
+ * | Target Mode Management  |   0xf080   | 0xf002 |
  * |  || 0xf046-0xf049  |
  * | Target Mode Task Management  |  0x1000b  ||
  * --
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 766fdfc..4895a4a 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -3462,20 +3462,43 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
if ((fcport-flags  FCF_FABRIC_DEVICE) == 0)
continue;
 
-   if (fcport-scan_state == QLA_FCPORT_SCAN 
-   atomic_read(fcport-state) == FCS_ONLINE) {
-   qla2x00_mark_device_lost(vha, fcport,
-   ql2xplogiabsentdevice, 0);
-   if (fcport-loop_id != FC_NO_LOOP_ID 
-   (fcport-flags  FCF_FCP2_DEVICE) == 0 
-   fcport-port_type != FCT_INITIATOR 
-   fcport-port_type != FCT_BROADCAST) {
-   ha-isp_ops-fabric_logout(vha,
-   fcport-loop_id,
-   fcport-d_id.b.domain,
-   fcport-d_id.b.area,
-   fcport-d_id.b.al_pa);
-   qla2x00_clear_loop_id(fcport);
+   if (fcport-scan_state == QLA_FCPORT_SCAN) {
+   if (qla_ini_mode_enabled(base_vha) 
+   atomic_read(fcport-state) == FCS_ONLINE) {
+   qla2x00_mark_device_lost(vha, fcport,
+   ql2xplogiabsentdevice, 0);
+   if (fcport-loop_id != FC_NO_LOOP_ID 
+   (fcport-flags  FCF_FCP2_DEVICE) 
== 0 
+   fcport-port_type != FCT_INITIATOR 

+   fcport-port_type != FCT_BROADCAST) 
{
+   ha-isp_ops-fabric_logout(vha,
+   fcport-loop_id,
+   fcport-d_id.b.domain,
+   fcport-d_id.b.area,
+   fcport-d_id.b.al_pa);
+