@@ -2691,7 +2691,7 @@ static int pmcraid_error_handler(struct pmcraid_cmd *cmd)
2691
2691
* SUCCESS / FAILED
2692
2692
*/
2693
2693
static int pmcraid_reset_device (
2694
- struct scsi_cmnd * scsi_cmd ,
2694
+ struct scsi_device * scsi_dev ,
2695
2695
unsigned long timeout ,
2696
2696
u8 modifier )
2697
2697
{
@@ -2703,11 +2703,11 @@ static int pmcraid_reset_device(
2703
2703
u32 ioasc ;
2704
2704
2705
2705
pinstance =
2706
- (struct pmcraid_instance * )scsi_cmd -> device -> host -> hostdata ;
2707
- res = scsi_cmd -> device -> hostdata ;
2706
+ (struct pmcraid_instance * )scsi_dev -> host -> hostdata ;
2707
+ res = scsi_dev -> hostdata ;
2708
2708
2709
2709
if (!res ) {
2710
- sdev_printk (KERN_ERR , scsi_cmd -> device ,
2710
+ sdev_printk (KERN_ERR , scsi_dev ,
2711
2711
"reset_device: NULL resource pointer\n" );
2712
2712
return FAILED ;
2713
2713
}
@@ -3018,16 +3018,46 @@ static int pmcraid_eh_device_reset_handler(struct scsi_cmnd *scmd)
3018
3018
{
3019
3019
scmd_printk (KERN_INFO , scmd ,
3020
3020
"resetting device due to an I/O command timeout.\n" );
3021
- return pmcraid_reset_device (scmd ,
3021
+ return pmcraid_reset_device (scmd -> device ,
3022
3022
PMCRAID_INTERNAL_TIMEOUT ,
3023
3023
RESET_DEVICE_LUN );
3024
3024
}
3025
3025
3026
3026
static int pmcraid_eh_bus_reset_handler (struct scsi_cmnd * scmd )
3027
3027
{
3028
- scmd_printk (KERN_INFO , scmd ,
3028
+ struct Scsi_Host * host = scmd -> device -> host ;
3029
+ struct pmcraid_instance * pinstance =
3030
+ (struct pmcraid_instance * )host -> hostdata ;
3031
+ struct pmcraid_resource_entry * res = NULL ;
3032
+ struct pmcraid_resource_entry * temp ;
3033
+ struct scsi_device * sdev = NULL ;
3034
+ unsigned long lock_flags ;
3035
+
3036
+ /*
3037
+ * The reset device code insists on us passing down
3038
+ * a device, so grab the first device on the bus.
3039
+ */
3040
+ spin_lock_irqsave (& pinstance -> resource_lock , lock_flags );
3041
+ list_for_each_entry (temp , & pinstance -> used_res_q , queue ) {
3042
+ if (scmd -> device -> channel == PMCRAID_VSET_BUS_ID &&
3043
+ RES_IS_VSET (temp -> cfg_entry )) {
3044
+ res = temp ;
3045
+ break ;
3046
+ } else if (scmd -> device -> channel == PMCRAID_PHYS_BUS_ID &&
3047
+ RES_IS_GSCSI (temp -> cfg_entry )) {
3048
+ res = temp ;
3049
+ break ;
3050
+ }
3051
+ }
3052
+ if (res )
3053
+ sdev = res -> scsi_dev ;
3054
+ spin_unlock_irqrestore (& pinstance -> resource_lock , lock_flags );
3055
+ if (!sdev )
3056
+ return FAILED ;
3057
+
3058
+ sdev_printk (KERN_INFO , sdev ,
3029
3059
"Doing bus reset due to an I/O command timeout.\n" );
3030
- return pmcraid_reset_device (scmd ,
3060
+ return pmcraid_reset_device (sdev ,
3031
3061
PMCRAID_RESET_BUS_TIMEOUT ,
3032
3062
RESET_DEVICE_BUS );
3033
3063
}
@@ -3036,7 +3066,7 @@ static int pmcraid_eh_target_reset_handler(struct scsi_cmnd *scmd)
3036
3066
{
3037
3067
scmd_printk (KERN_INFO , scmd ,
3038
3068
"Doing target reset due to an I/O command timeout.\n" );
3039
- return pmcraid_reset_device (scmd ,
3069
+ return pmcraid_reset_device (scmd -> device ,
3040
3070
PMCRAID_INTERNAL_TIMEOUT ,
3041
3071
RESET_DEVICE_TARGET );
3042
3072
}
0 commit comments