diff mbox series

[05/20] mptfc: open-code mptfc_block_error_handler() for bus reset

Message ID 20220512111236.109851-6-hare@suse.de (mailing list archive)
State Superseded
Headers show
Series scsi: EH rework prep patches, part 1 | expand

Commit Message

Hannes Reinecke May 12, 2022, 11:12 a.m. UTC
When calling bus_reset we have potentially several ports to be
reset, so this patch open-codes the existing mptfc_block_error_handler()
to wait for all ports attached to this bus.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 drivers/message/fusion/mptfc.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

Comments

Ewan Milne May 19, 2022, 5:05 p.m. UTC | #1
This change removes the debug log messages that mptfc_block_error_handler()
would have generated, and also doesn't do the same thing, at all, for each rport
due to the differences in the logic between fc_block_rport() and
fc_remote_port_chkready()
and waiting for ioc->active == 0.

Perhaps this is desirable and intentional, if so, could you explain
this in the commit message?

-Ewan

On Thu, May 12, 2022 at 7:13 AM Hannes Reinecke <hare@suse.de> wrote:
>
> When calling bus_reset we have potentially several ports to be
> reset, so this patch open-codes the existing mptfc_block_error_handler()
> to wait for all ports attached to this bus.
>
> Signed-off-by: Hannes Reinecke <hare@suse.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
>  drivers/message/fusion/mptfc.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
> index ea8fc32dacfa..4a621380a4eb 100644
> --- a/drivers/message/fusion/mptfc.c
> +++ b/drivers/message/fusion/mptfc.c
> @@ -262,12 +262,23 @@ static int
>  mptfc_bus_reset(struct scsi_cmnd *SCpnt)
>  {
>         struct Scsi_Host *shost = SCpnt->device->host;
> -       struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device));
>         MPT_SCSI_HOST __maybe_unused *hd = shost_priv(shost);
> +       int channel = SCpnt->device->channel;
> +       struct mptfc_rport_info *ri;
>         int rtn;
>
> -       rtn = mptfc_block_error_handler(rport);
> -       if (rtn == SUCCESS) {
> +       list_for_each_entry(ri, &hd->ioc->fc_rports, list) {
> +               if (ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED) {
> +                       VirtTarget *vtarget = ri->starget->hostdata;
> +
> +                       if (!vtarget || vtarget->channel != channel)
> +                               continue;
> +                       rtn = fc_block_rport(ri->rport);
> +                       if (rtn != 0)
> +                               break;
> +               }
> +       }
> +       if (rtn == 0) {
>                 dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT
>                         "%s.%d: %d:%llu, executing recovery.\n", __func__,
>                         hd->ioc->name, shost->host_no,
> --
> 2.29.2
>
Hannes Reinecke May 20, 2022, 6:42 a.m. UTC | #2
On 5/19/22 10:05, Ewan Milne wrote:
> This change removes the debug log messages that mptfc_block_error_handler()
> would have generated, and also doesn't do the same thing, at all, for each rport
> due to the differences in the logic between fc_block_rport() and
> fc_remote_port_chkready()
> and waiting for ioc->active == 0.
> 
Yes, I'll be adding back the checks for ioc->active.

> Perhaps this is desirable and intentional, if so, could you explain
> this in the commit message?
> 
Removing the debug calls was intentional; if needs be they can be 
activated via scsi_logging_level.

I'll be updating the commit message.

Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index ea8fc32dacfa..4a621380a4eb 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -262,12 +262,23 @@  static int
 mptfc_bus_reset(struct scsi_cmnd *SCpnt)
 {
 	struct Scsi_Host *shost = SCpnt->device->host;
-	struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device));
 	MPT_SCSI_HOST __maybe_unused *hd = shost_priv(shost);
+	int channel = SCpnt->device->channel;
+	struct mptfc_rport_info *ri;
 	int rtn;
 
-	rtn = mptfc_block_error_handler(rport);
-	if (rtn == SUCCESS) {
+	list_for_each_entry(ri, &hd->ioc->fc_rports, list) {
+		if (ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED) {
+			VirtTarget *vtarget = ri->starget->hostdata;
+
+			if (!vtarget || vtarget->channel != channel)
+				continue;
+			rtn = fc_block_rport(ri->rport);
+			if (rtn != 0)
+				break;
+		}
+	}
+	if (rtn == 0) {
 		dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT
 			"%s.%d: %d:%llu, executing recovery.\n", __func__,
 			hd->ioc->name, shost->host_no,