@@ -2930,18 +2930,6 @@ static void ibmvfc_dev_cancel_all_noreset(struct scsi_device *sdev, void *data)
2930
2930
* rc |= ibmvfc_cancel_all (sdev , IBMVFC_TMF_SUPPRESS_ABTS );
2931
2931
}
2932
2932
2933
- /**
2934
- * ibmvfc_dev_cancel_all_reset - Device iterated cancel all function
2935
- * @sdev: scsi device struct
2936
- * @data: return code
2937
- *
2938
- **/
2939
- static void ibmvfc_dev_cancel_all_reset (struct scsi_device * sdev , void * data )
2940
- {
2941
- unsigned long * rc = data ;
2942
- * rc |= ibmvfc_cancel_all (sdev , IBMVFC_TMF_TGT_RESET );
2943
- }
2944
-
2945
2933
/**
2946
2934
* ibmvfc_eh_target_reset_handler - Reset the target
2947
2935
* @cmd: scsi command struct
@@ -2951,22 +2939,38 @@ static void ibmvfc_dev_cancel_all_reset(struct scsi_device *sdev, void *data)
2951
2939
**/
2952
2940
static int ibmvfc_eh_target_reset_handler (struct scsi_cmnd * cmd )
2953
2941
{
2954
- struct scsi_device * sdev = cmd -> device ;
2955
- struct ibmvfc_host * vhost = shost_priv (sdev -> host );
2956
- struct scsi_target * starget = scsi_target (sdev );
2942
+ struct scsi_target * starget = scsi_target (cmd -> device );
2943
+ struct fc_rport * rport = starget_to_rport (starget );
2944
+ struct Scsi_Host * shost = rport_to_shost (rport );
2945
+ struct ibmvfc_host * vhost = shost_priv (shost );
2957
2946
int block_rc ;
2958
2947
int reset_rc = 0 ;
2959
2948
int rc = FAILED ;
2960
2949
unsigned long cancel_rc = 0 ;
2950
+ bool tgt_reset = false;
2961
2951
2962
2952
ENTER ;
2963
- block_rc = fc_block_scsi_eh ( cmd );
2953
+ block_rc = fc_block_rport ( rport );
2964
2954
ibmvfc_wait_while_resetting (vhost );
2965
2955
if (block_rc != FAST_IO_FAIL ) {
2966
- starget_for_each_device (starget , & cancel_rc , ibmvfc_dev_cancel_all_reset );
2967
- reset_rc = ibmvfc_reset_device (sdev , IBMVFC_TARGET_RESET , "target" );
2956
+ struct scsi_device * sdev ;
2957
+
2958
+ shost_for_each_device (sdev , shost ) {
2959
+ if ((sdev -> channel != starget -> channel ) ||
2960
+ (sdev -> id != starget -> id ))
2961
+ continue ;
2962
+
2963
+ cancel_rc |= ibmvfc_cancel_all (sdev ,
2964
+ IBMVFC_TMF_TGT_RESET );
2965
+ if (!tgt_reset ) {
2966
+ reset_rc = ibmvfc_reset_device (sdev ,
2967
+ IBMVFC_TARGET_RESET , "target" );
2968
+ tgt_reset = true;
2969
+ }
2970
+ }
2968
2971
} else
2969
- starget_for_each_device (starget , & cancel_rc , ibmvfc_dev_cancel_all_noreset );
2972
+ starget_for_each_device (starget , & cancel_rc ,
2973
+ ibmvfc_dev_cancel_all_noreset );
2970
2974
2971
2975
if (!cancel_rc && !reset_rc )
2972
2976
rc = ibmvfc_wait_for_ops (vhost , starget , ibmvfc_match_target );
0 commit comments