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.com>,
Johannes Thumshirn <johannes.thumshirn@wdc.com>,
Tyrel Datwyler <tyreld@linux.ibm.com>
Subject: [PATCH 08/16] ibmvfc: open-code reset loop for target reset
Date: Tue, 24 May 2022 08:15:54 +0200 [thread overview]
Message-ID: <20220524061602.86760-9-hare@suse.de> (raw)
In-Reply-To: <20220524061602.86760-1-hare@suse.de>
From: Hannes Reinecke <hare@suse.com>
For target reset we need a device to send the target reset to,
so open-code the loop in target reset to send the target reset TMF
to the correct device.
Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: Tyrel Datwyler <tyreld@linux.ibm.com>
---
drivers/scsi/ibmvscsi/ibmvfc.c | 41 ++++++++++++++++++----------------
1 file changed, 22 insertions(+), 19 deletions(-)
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index d0eab5700dc5..1287153ec053 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -2925,18 +2925,6 @@ static void ibmvfc_dev_cancel_all_noreset(struct scsi_device *sdev, void *data)
*rc |= ibmvfc_cancel_all(sdev, IBMVFC_TMF_SUPPRESS_ABTS);
}
-/**
- * ibmvfc_dev_cancel_all_reset - Device iterated cancel all function
- * @sdev: scsi device struct
- * @data: return code
- *
- **/
-static void ibmvfc_dev_cancel_all_reset(struct scsi_device *sdev, void *data)
-{
- unsigned long *rc = data;
- *rc |= ibmvfc_cancel_all(sdev, IBMVFC_TMF_TGT_RESET);
-}
-
/**
* ibmvfc_eh_target_reset_handler - Reset the target
* @cmd: scsi command struct
@@ -2946,22 +2934,37 @@ static void ibmvfc_dev_cancel_all_reset(struct scsi_device *sdev, void *data)
**/
static int ibmvfc_eh_target_reset_handler(struct scsi_cmnd *cmd)
{
- struct scsi_device *sdev = cmd->device;
- struct ibmvfc_host *vhost = shost_priv(sdev->host);
- struct scsi_target *starget = scsi_target(sdev);
+ struct scsi_target *starget = scsi_target(cmd->device);
+ struct fc_rport *rport = starget_to_rport(starget);
+ struct Scsi_Host *shost = rport_to_shost(rport);
+ struct ibmvfc_host *vhost = shost_priv(shost);
int block_rc;
int reset_rc = 0;
int rc = FAILED;
unsigned long cancel_rc = 0;
ENTER;
- block_rc = fc_block_scsi_eh(cmd);
+ block_rc = fc_block_rport(rport);
ibmvfc_wait_while_resetting(vhost);
if (block_rc != FAST_IO_FAIL) {
- starget_for_each_device(starget, &cancel_rc, ibmvfc_dev_cancel_all_reset);
- reset_rc = ibmvfc_reset_device(sdev, IBMVFC_TARGET_RESET, "target");
+ struct scsi_device *sdev, *reset_sdev = NULL;
+
+ shost_for_each_device(sdev, shost) {
+ if ((sdev->channel != starget->channel) ||
+ (sdev->id != starget->id))
+ continue;
+
+ cancel_rc |= ibmvfc_cancel_all(sdev,
+ IBMVFC_TMF_TGT_RESET);
+ if (!reset_sdev)
+ reset_sdev = sdev;
+ }
+ if (reset_sdev)
+ reset_rc = ibmvfc_reset_device(reset_sdev,
+ IBMVFC_TARGET_RESET, "target");
} else
- starget_for_each_device(starget, &cancel_rc, ibmvfc_dev_cancel_all_noreset);
+ starget_for_each_device(starget, &cancel_rc,
+ ibmvfc_dev_cancel_all_noreset);
if (!cancel_rc && !reset_rc)
rc = ibmvfc_wait_for_ops(vhost, starget, ibmvfc_match_target);
--
2.29.2
next prev parent reply other threads:[~2022-05-24 6:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-24 6:15 [PATCHv4 00/16] scsi: EH rework prep patches, part 1 Hannes Reinecke
2022-05-24 6:15 ` [PATCH 01/16] csiostor: use fc_block_rport() Hannes Reinecke
2022-05-24 6:15 ` [PATCH 02/16] fc_fcp: " Hannes Reinecke
2022-05-24 6:15 ` [PATCH 03/16] mptfc: simplify mpt_fc_block_error_handler() Hannes Reinecke
2022-05-24 6:15 ` [PATCH 04/16] mptfusion: correct definitions for mptscsih_dev_reset() Hannes Reinecke
2022-05-24 6:15 ` [PATCH 05/16] mptfc: open-code mptfc_block_error_handler() for bus reset Hannes Reinecke
2022-05-24 6:15 ` [PATCH 06/16] qedf: use fc rport as argument for qedf_initiate_tmf() Hannes Reinecke
2022-05-24 11:16 ` Steffen Maier
2022-05-24 11:26 ` Hannes Reinecke
2022-05-24 6:15 ` [PATCH 07/16] bnx2fc: Do not rely on a scsi command for lun or target reset Hannes Reinecke
2022-05-24 6:15 ` Hannes Reinecke [this message]
2022-05-24 6:15 ` [PATCH 09/16] ibmvfc: use fc_block_rport() Hannes Reinecke
2022-05-24 6:15 ` [PATCH 10/16] fnic: use fc_block_rport() correctly Hannes Reinecke
2022-05-24 6:15 ` [PATCH 11/16] aic7xxx: make BUILD_SCSIID() a function Hannes Reinecke
2022-05-24 6:15 ` [PATCH 12/16] aic79xx: " Hannes Reinecke
2022-05-24 6:15 ` [PATCH 13/16] aic7xxx: do not reference scsi command when resetting device Hannes Reinecke
2022-05-24 6:16 ` [PATCH 14/16] aic79xx: " Hannes Reinecke
2022-05-24 6:16 ` [PATCH 15/16] ips: Do not try to abort command from host reset Hannes Reinecke
2022-05-24 6:16 ` [PATCH 16/16] megaraid: pass in NULL scb for " Hannes Reinecke
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=20220524061602.86760-9-hare@suse.de \
--to=hare@suse.de \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=tyreld@linux.ibm.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