aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pmcraid.c
diff options
context:
space:
mode:
authorHannes Reinecke <[email protected]>2023-10-02 15:43:27 +0000
committerMartin K. Petersen <[email protected]>2023-10-13 18:23:15 +0000
commitc2a14ab3b9b38d9408a0388a0c65dce546169907 (patch)
treea93c99b0963278a7e3a4e20aeb3b344c58ebbfcc /drivers/scsi/pmcraid.c
parentscsi: pmcraid: Select device in pmcraid_eh_bus_reset_handler() (diff)
downloadkernel-c2a14ab3b9b38d9408a0388a0c65dce546169907.tar.gz
kernel-c2a14ab3b9b38d9408a0388a0c65dce546169907.zip
scsi: pmcraid: Select device in pmcraid_eh_target_reset_handler()
The reset code requires a device to be selected, but we shouldn't rely on the command to provide a device for us. So select the first device on the target when sending down a target reset. Signed-off-by: Hannes Reinecke <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
Diffstat (limited to 'drivers/scsi/pmcraid.c')
-rw-r--r--drivers/scsi/pmcraid.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index d7a331255e71..a831b34c08a4 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -3064,9 +3064,21 @@ static int pmcraid_eh_bus_reset_handler(struct scsi_cmnd *scmd)
static int pmcraid_eh_target_reset_handler(struct scsi_cmnd *scmd)
{
- scmd_printk(KERN_INFO, scmd,
+ struct Scsi_Host *shost = scmd->device->host;
+ struct scsi_device *scsi_dev = NULL, *tmp;
+
+ shost_for_each_device(tmp, shost) {
+ if ((tmp->channel == scmd->device->channel) &&
+ (tmp->id == scmd->device->id)) {
+ scsi_dev = tmp;
+ break;
+ }
+ }
+ if (!scsi_dev)
+ return FAILED;
+ sdev_printk(KERN_INFO, scsi_dev,
"Doing target reset due to an I/O command timeout.\n");
- return pmcraid_reset_device(scmd->device,
+ return pmcraid_reset_device(scsi_dev,
PMCRAID_INTERNAL_TIMEOUT,
RESET_DEVICE_TARGET);
}