WSL2-Linux-Kernel/drivers/s390/scsi
Steffen Maier 8c9db6679b scsi: zfcp: Fix failed recovery on gone remote port with non-NPIV FCP devices
Suppose we have an environment with a number of non-NPIV FCP devices
(virtual HBAs / FCP devices / zfcp "adapter"s) sharing the same physical
FCP channel (HBA port) and its I_T nexus. Plus a number of storage target
ports zoned to such shared channel. Now one target port logs out of the
fabric causing an RSCN. Zfcp reacts with an ADISC ELS and subsequent port
recovery depending on the ADISC result. This happens on all such FCP
devices (in different Linux images) concurrently as they all receive a copy
of this RSCN. In the following we look at one of those FCP devices.

Requests other than FSF_QTCB_FCP_CMND can be slow until they get a
response.

Depending on which requests are affected by slow responses, there are
different recovery outcomes. Here we want to fix failed recoveries on port
or adapter level by avoiding recovery requests that can be slow.

We need the cached N_Port_ID for the remote port "link" test with ADISC.
Just before sending the ADISC, we now intentionally forget the old cached
N_Port_ID. The idea is that on receiving an RSCN for a port, we have to
assume that any cached information about this port is stale.  This forces a
fresh new GID_PN [FC-GS] nameserver lookup on any subsequent recovery for
the same port. Since we typically can still communicate with the nameserver
efficiently, we now reach steady state quicker: Either the nameserver still
does not know about the port so we stop recovery, or the nameserver already
knows the port potentially with a new N_Port_ID and we can successfully and
quickly perform open port recovery.  For the one case, where ADISC returns
successfully, we re-initialize port->d_id because that case does not
involve any port recovery.

This also solves a problem if the storage WWPN quickly logs into the fabric
again but with a different N_Port_ID. Such as on virtual WWPN takeover
during target NPIV failover.
[https://www.redbooks.ibm.com/abstracts/redp5477.html] In that case the
RSCN from the storage FDISC was ignored by zfcp and we could not
successfully recover the failover. On some later failback on the storage,
we could have been lucky if the virtual WWPN got the same old N_Port_ID
from the SAN switch as we still had cached.  Then the related RSCN
triggered a successful port reopen recovery.  However, there is no
guarantee to get the same N_Port_ID on NPIV FDISC.

Even though NPIV-enabled FCP devices are not affected by this problem, this
code change optimizes recovery time for gone remote ports as a side effect.
The timely drop of cached N_Port_IDs prevents unnecessary slow open port
attempts.

While the problem might have been in code before v2.6.32 commit
799b76d09a ("[SCSI] zfcp: Decouple gid_pn requests from erp") this fix
depends on the gid_pn_work introduced with that commit, so we mark it as
culprit to satisfy fix dependencies.

Note: Point-to-point remote port is already handled separately and gets its
N_Port_ID from the cached peer_d_id. So resetting port->d_id in general
does not affect PtP.

Link: https://lore.kernel.org/r/20220118165803.3667947-1-maier@linux.ibm.com
Fixes: 799b76d09a ("[SCSI] zfcp: Decouple gid_pn requests from erp")
Cc: <stable@vger.kernel.org> #2.6.32+
Suggested-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-01-24 23:30:27 -05:00
..
Makefile
zfcp_aux.c
zfcp_ccw.c
zfcp_dbf.c scsi: zfcp: fix kernel doc comments 2021-09-08 14:23:31 +02:00
zfcp_dbf.h
zfcp_def.h
zfcp_diag.c
zfcp_diag.h
zfcp_erp.c
zfcp_ext.h scsi: zfcp: Switch to attribute groups 2021-10-16 21:45:53 -04:00
zfcp_fc.c scsi: zfcp: Fix failed recovery on gone remote port with non-NPIV FCP devices 2022-01-24 23:30:27 -05:00
zfcp_fc.h
zfcp_fsf.c scsi: zfcp_scsi: Call scsi_done() directly 2021-10-16 21:28:44 -04:00
zfcp_fsf.h
zfcp_qdio.c s390/qdio: split do_QDIO() 2021-12-06 14:42:25 +01:00
zfcp_qdio.h
zfcp_reqlist.h
zfcp_scsi.c scsi: zfcp: Switch to attribute groups 2021-10-16 21:45:53 -04:00
zfcp_sysfs.c scsi: zfcp: Switch to attribute groups 2021-10-16 21:45:53 -04:00
zfcp_unit.c scsi: zfcp: fix kernel doc comments 2021-09-08 14:23:31 +02:00