public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
	James Bottomley <james.bottomley@hansenpartnership.com>,
	linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
	Hannes Reinecke <hare@suse.com>,
	Steffen Maier <maier@linux.ibm.com>,
	Benjamin Block <bblock@linux.ibm.com>
Subject: [PATCH 03/24] zfcp: open-code fc_block_scsi_eh() for host reset
Date: Mon,  2 May 2022 23:37:59 +0200	[thread overview]
Message-ID: <20220502213820.3187-4-hare@suse.de> (raw)
In-Reply-To: <20220502213820.3187-1-hare@suse.de>

When issuing a host reset we should be waiting for all
ports to become unblocked; just waiting for one might
be resulting in host reset to return too early.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Cc: Steffen Maier <maier@linux.ibm.com>
Cc: Benjamin Block <bblock@linux.ibm.com>
---
 drivers/s390/scsi/zfcp_scsi.c | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 526ac240d9fe..fb2b73fca381 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -373,9 +373,11 @@ static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt)
 
 static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
 {
-	struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
-	struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
-	int ret = SUCCESS, fc_ret;
+	struct Scsi_Host *host = scpnt->device->host;
+	struct zfcp_adapter *adapter = (struct zfcp_adapter *)host->hostdata[0];
+	int ret = SUCCESS;
+	unsigned long flags;
+	struct zfcp_port *port;
 
 	if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE)) {
 		zfcp_erp_port_forced_reopen_all(adapter, 0, "schrh_p");
@@ -383,9 +385,24 @@ static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
 	}
 	zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
 	zfcp_erp_wait(adapter);
-	fc_ret = fc_block_scsi_eh(scpnt);
-	if (fc_ret)
-		ret = fc_ret;
+retry_rport_blocked:
+	spin_lock_irqsave(host->host_lock, flags);
+	list_for_each_entry(port, &adapter->port_list, list) {
+		struct fc_rport *rport = port->rport;
+
+		if (rport->port_state == FC_PORTSTATE_BLOCKED) {
+			if (rport->flags & FC_RPORT_FAST_FAIL_TIMEDOUT)
+				ret = FAST_IO_FAIL;
+			else
+				ret = NEEDS_RETRY;
+			break;
+		}
+	}
+	spin_unlock_irqrestore(host->host_lock, flags);
+	if (ret == NEEDS_RETRY) {
+		msleep(1000);
+		goto retry_rport_blocked;
+	}
 
 	zfcp_dbf_scsi_eh("schrh_r", adapter, ~0, ret);
 	return ret;
-- 
2.29.2


  parent reply	other threads:[~2022-05-02 21:38 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02 21:37 [PATCH 00/24] scsi: EH rework prep patches, part 1 Hannes Reinecke
2022-05-02 21:37 ` [PATCH 01/24] csiostor: use fc_block_rport() Hannes Reinecke
2022-05-03 14:06   ` Christoph Hellwig
2022-05-03 14:43   ` Johannes Thumshirn
2022-05-03 16:09   ` Bart Van Assche
2022-05-02 21:37 ` [PATCH 02/24] fc_fcp: " Hannes Reinecke
2022-05-03 14:06   ` Christoph Hellwig
2022-05-03 14:44   ` Johannes Thumshirn
2022-05-03 16:09   ` Bart Van Assche
2022-05-02 21:37 ` Hannes Reinecke [this message]
2022-05-03 14:06   ` [PATCH 03/24] zfcp: open-code fc_block_scsi_eh() for host reset Christoph Hellwig
2022-05-03 17:21   ` Steffen Maier
2022-05-03 18:42     ` Hannes Reinecke
2022-05-02 21:38 ` [PATCH 04/24] mptfc: simplify mpt_fc_block_error_handler() Hannes Reinecke
2022-05-03 14:07   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 05/24] mptfusion: correct definitions for mptscsih_dev_reset() Hannes Reinecke
2022-05-03 14:07   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 06/24] mptfc: open-code mptfc_block_error_handler() for bus reset Hannes Reinecke
2022-05-03 14:08   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 07/24] qedf: use fc rport as argument for qedf_initiate_tmf() Hannes Reinecke
2022-05-03 14:08   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 08/24] bnx2fc: Do not rely on a scsi command for lun or target reset Hannes Reinecke
2022-05-03 14:08   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 09/24] ibmvfc: open-code reset loop for " Hannes Reinecke
2022-05-03 14:09   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 10/24] ibmvfc: use fc_block_rport() Hannes Reinecke
2022-05-03 14:09   ` Christoph Hellwig
2022-05-03 15:20   ` Johannes Thumshirn
2022-05-03 16:11   ` Bart Van Assche
2022-05-02 21:38 ` [PATCH 11/24] fnic: use dedicated device reset command Hannes Reinecke
2022-05-03 14:09   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 12/24] fnic: use fc_block_rport() correctly Hannes Reinecke
2022-05-03 14:10   ` Christoph Hellwig
2022-05-03 15:22   ` Johannes Thumshirn
2022-05-02 21:38 ` [PATCH 13/24] aic7xxx: make BUILD_SCSIID() a function Hannes Reinecke
2022-05-03  9:39   ` kernel test robot
2022-05-03 14:12   ` Christoph Hellwig
2022-05-03 14:18     ` Hannes Reinecke
2022-05-02 21:38 ` [PATCH 14/24] aic79xx: " Hannes Reinecke
2022-05-03 14:13   ` Christoph Hellwig
2022-05-03 14:19     ` Hannes Reinecke
2022-05-02 21:38 ` [PATCH 15/24] aic7xxx: do not reference scsi command when resetting device Hannes Reinecke
2022-05-03 14:13   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 16/24] aic79xx: " Hannes Reinecke
2022-05-03 14:17   ` Christoph Hellwig
2022-05-03 15:25   ` Johannes Thumshirn
2022-05-02 21:38 ` [PATCH 17/24] snic: reserve tag for TMF Hannes Reinecke
2022-05-03 14:18   ` Christoph Hellwig
2022-05-03 15:41   ` Johannes Thumshirn
2022-05-03 16:18   ` Bart Van Assche
2022-05-03 18:31     ` Hannes Reinecke
2022-05-03 20:09       ` Bart Van Assche
2022-05-06 13:28   ` John Garry
2022-05-07  7:32     ` Hannes Reinecke
2022-05-09  6:44       ` John Garry
2022-05-02 21:38 ` [PATCH 18/24] snic: use dedicated device reset command Hannes Reinecke
2022-05-03 14:19   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 19/24] snic: Use scsi_host_busy_iter() to traverse commands Hannes Reinecke
2022-05-03 14:19   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 20/24] sym53c8xx_2: split off bus reset from host reset Hannes Reinecke
2022-05-03 14:20   ` Christoph Hellwig
2022-05-03 15:42   ` Johannes Thumshirn
2022-05-02 21:38 ` [PATCH 21/24] ips: Do not try to abort command " Hannes Reinecke
2022-05-03 14:20   ` Christoph Hellwig
2022-05-03 15:43   ` Johannes Thumshirn
2022-05-02 21:38 ` [PATCH 22/24] qla1280: separate out host reset function from qla1280_error_action() Hannes Reinecke
2022-05-03 14:20   ` Christoph Hellwig
2022-05-02 21:38 ` [PATCH 23/24] megaraid: pass in NULL scb for host reset Hannes Reinecke
2022-05-03 14:20   ` Christoph Hellwig
2022-05-03 16:09   ` Johannes Thumshirn
2022-05-02 21:38 ` [PATCH 24/24] mpi3mr: split off bus_reset function from host_reset Hannes Reinecke
2022-05-03 14:21   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2022-05-03 20:06 [PATCHv2 00/24] scsi: EH rework prep patches, part 1 Hannes Reinecke
2022-05-03 20:06 ` [PATCH 03/24] zfcp: open-code fc_block_scsi_eh() for host reset Hannes Reinecke
2022-05-04 10:46   ` Steffen Maier
2022-05-04 11:40     ` Steffen Maier
2022-05-12  6:12       ` Steffen Maier
2022-05-04 11:01   ` Benjamin Block
2022-05-04 11:09     ` Benjamin Block
2022-05-04 11:33     ` Benjamin Block

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220502213820.3187-4-hare@suse.de \
    --to=hare@suse.de \
    --cc=bblock@linux.ibm.com \
    --cc=hare@suse.com \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=maier@linux.ibm.com \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox