[PATCH 51/51] scsi_error: streamline scsi_eh_bus_device_reset()
From: Hannes Reinecke <hare@suse.de>
Date: 2021-08-17 09:17:39
Subsystem:
scsi subsystem, the rest · Maintainers:
"James E.J. Bottomley", "Martin K. Petersen", Linus Torvalds
From: Hannes Reinecke <hare@suse.com> Streamline to use a similar code flow than the other reset functions. Signed-off-by: Hannes Reinecke <hare@suse.com> --- drivers/scsi/scsi_error.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 5cfff3fa306c..d4ab10113648 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c@@ -1516,6 +1516,7 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost, { struct scsi_cmnd *scmd, *bdr_scmd, *next; struct scsi_device *sdev; + LIST_HEAD(check_list); enum scsi_disposition rtn; shost_for_each_device(sdev, shost) {
@@ -1541,27 +1542,22 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost, sdev_printk(KERN_INFO, sdev, "%s: Sending BDR\n", current->comm)); rtn = scsi_try_bus_device_reset(sdev); - if (rtn == SUCCESS || rtn == FAST_IO_FAIL) { - if (!scsi_device_online(sdev) || - rtn == FAST_IO_FAIL || - !scsi_eh_tur(bdr_scmd)) { - list_for_each_entry_safe(scmd, next, - work_q, eh_entry) { - if (scmd->device == sdev && - scsi_eh_action(scmd, rtn) != FAILED) - __scsi_eh_finish_cmd(scmd, - done_q, - DID_RESET); - } - } - } else { + if (rtn != SUCCESS && rtn != FAST_IO_FAIL) SCSI_LOG_ERROR_RECOVERY(3, sdev_printk(KERN_INFO, sdev, "%s: BDR failed\n", current->comm)); + list_for_each_entry_safe(scmd, next, work_q, eh_entry) { + if (scmd->device != sdev) + continue; + if (rtn == SUCCESS) + list_move_tail(&scmd->eh_entry, &check_list); + else if (rtn == FAST_IO_FAIL) + __scsi_eh_finish_cmd(scmd, done_q, + DID_TRANSPORT_DISRUPTED); } } - return list_empty(work_q); + return scsi_eh_test_devices(&check_list, work_q, done_q, 0); } /**
--
2.29.2