Skip to content

Commit 397ff21

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi: ibmvfc: Open-code reset loop for target reset
For target reset we need a device to send the target reset to, so open-code the loop in target reset to send the target reset TMF to the correct device. Signed-off-by: Hannes Reinecke <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: Tyrel Datwyler <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent c67e638 commit 397ff21

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

drivers/scsi/ibmvscsi/ibmvfc.c

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2930,18 +2930,6 @@ static void ibmvfc_dev_cancel_all_noreset(struct scsi_device *sdev, void *data)
29302930
*rc |= ibmvfc_cancel_all(sdev, IBMVFC_TMF_SUPPRESS_ABTS);
29312931
}
29322932

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-
29452933
/**
29462934
* ibmvfc_eh_target_reset_handler - Reset the target
29472935
* @cmd: scsi command struct
@@ -2951,22 +2939,38 @@ static void ibmvfc_dev_cancel_all_reset(struct scsi_device *sdev, void *data)
29512939
**/
29522940
static int ibmvfc_eh_target_reset_handler(struct scsi_cmnd *cmd)
29532941
{
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);
29572946
int block_rc;
29582947
int reset_rc = 0;
29592948
int rc = FAILED;
29602949
unsigned long cancel_rc = 0;
2950+
bool tgt_reset = false;
29612951

29622952
ENTER;
2963-
block_rc = fc_block_scsi_eh(cmd);
2953+
block_rc = fc_block_rport(rport);
29642954
ibmvfc_wait_while_resetting(vhost);
29652955
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+
}
29682971
} 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);
29702974

29712975
if (!cancel_rc && !reset_rc)
29722976
rc = ibmvfc_wait_for_ops(vhost, starget, ibmvfc_match_target);

0 commit comments

Comments
 (0)