Skip to content

Commit c2a14ab

Browse files
hreineckemartinkpetersen
authored andcommitted
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]>
1 parent 09df469 commit c2a14ab

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/scsi/pmcraid.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3064,9 +3064,21 @@ static int pmcraid_eh_bus_reset_handler(struct scsi_cmnd *scmd)
30643064

30653065
static int pmcraid_eh_target_reset_handler(struct scsi_cmnd *scmd)
30663066
{
3067-
scmd_printk(KERN_INFO, scmd,
3067+
struct Scsi_Host *shost = scmd->device->host;
3068+
struct scsi_device *scsi_dev = NULL, *tmp;
3069+
3070+
shost_for_each_device(tmp, shost) {
3071+
if ((tmp->channel == scmd->device->channel) &&
3072+
(tmp->id == scmd->device->id)) {
3073+
scsi_dev = tmp;
3074+
break;
3075+
}
3076+
}
3077+
if (!scsi_dev)
3078+
return FAILED;
3079+
sdev_printk(KERN_INFO, scsi_dev,
30683080
"Doing target reset due to an I/O command timeout.\n");
3069-
return pmcraid_reset_device(scmd->device,
3081+
return pmcraid_reset_device(scsi_dev,
30703082
PMCRAID_INTERNAL_TIMEOUT,
30713083
RESET_DEVICE_TARGET);
30723084
}

0 commit comments

Comments
 (0)