On Mon, Oct 23, 2023 at 11:28:33AM +0200, Hannes Reinecke wrote: > Iterating over all possible bus number in scsi_eh_bus_reset() is > inefficient as not all busses may be affected during SCSI EH. > So rewrite the loop in scsi_eh_bus_reset() to match the loop > in scsi_eh_target_reset() and only loop over failed commands. > > Signed-off-by: Hannes Reinecke <hare@xxxxxxx> > Reviewed-by: Christoph Hellwig <hch@xxxxxx> > --- > drivers/scsi/scsi_error.c | 62 ++++++++++++++++----------------------- > 1 file changed, 25 insertions(+), 37 deletions(-) > > diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c > index 42e12756d6f4..7c9c376affda 100644 > --- a/drivers/scsi/scsi_error.c > +++ b/drivers/scsi/scsi_error.c > @@ -1716,43 +1715,32 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost, > + rtn = scsi_try_bus_reset(scmd); > + if (rtn != SUCCESS && rtn != FAST_IO_FAIL) { > SCSI_LOG_ERROR_RECOVERY(3, > shost_printk(KERN_INFO, shost, > "%s: BRST failed chan: %d\n", > current->comm, channel)); > } > + list_for_each_entry_safe(scmd, next, work_q, eh_entry) { You probably want to iterate over the `tmp_list`, not the `work_q`. > + if (scmd_channel(scmd) != channel) > + continue; > + -- Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294