diff mbox series

[3/3] mptfc: iterate over all rports during bus reset

Message ID 20210819091017.94142-4-hare@suse.de
State New
Headers show
Series mptfusion: Fixes for SCSI EH rework | expand

Commit Message

Hannes Reinecke Aug. 19, 2021, 9:10 a.m. UTC
When issuing a bus reset we need to call fc_block_rport() on all
ports, otherwise we might be executing the bus reset call prematurely.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/message/fusion/mptfc.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index 3962951c1e9a..952dc85bba08 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -227,14 +227,18 @@  mptfc_bus_reset(struct scsi_cmnd *SCpnt)
 {
 	struct scsi_device	*sdev = SCpnt->device;
 	struct Scsi_Host	*shost = sdev->host;
-	struct fc_rport		*rport = starget_to_rport(scsi_target(sdev));
 	MPT_SCSI_HOST		*hd = shost_priv(shost);
 	MPT_ADAPTER 		*ioc = hd->ioc;
+	struct mptfc_rport_info	*ri;
 	int rval;
 
-	rval = fc_block_rport(rport);
-	if (rval)
-		return rval;
+	list_for_each_entry(ri, &ioc->fc_rports, list) {
+		rval = fc_block_rport(ri->rport);
+		if (rval)
+			return rval;
+		if (ioc->active == 0)
+			return FAILED;
+	}
 	dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
 		"%s.%d: %d:%llu, executing recovery.\n",
 		ioc->name, __func__, ioc->sh->host_no,