From 27058486cb5c638f387389d2caa4f2a9bc849312 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Fri, 12 Sep 2008 16:46:51 -0500 Subject: [PATCH] --- yaml --- r: 115463 b: refs/heads/master c: c82dc88ddaf17112841dd3a6b08352968555ee08 h: refs/heads/master i: 115461: fcdfe1da172b70408dfb3adc7dd22d68650c59d4 115459: ef0401ef821dddc629e7365693d612278cc6fa66 115455: 316cdde86a2dde08a9bbf0b1e6a22fd1df3ff736 v: v3 --- [refs] | 2 +- trunk/drivers/scsi/scsi_error.c | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 9f7629bf8287..0154047eb688 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ea2151b4e142fa2de0319d9dd80413a997bf435a +refs/heads/master: c82dc88ddaf17112841dd3a6b08352968555ee08 diff --git a/trunk/drivers/scsi/scsi_error.c b/trunk/drivers/scsi/scsi_error.c index ad019ece2139..94ed262bdf0c 100644 --- a/trunk/drivers/scsi/scsi_error.c +++ b/trunk/drivers/scsi/scsi_error.c @@ -1065,10 +1065,10 @@ static int scsi_eh_target_reset(struct Scsi_Host *shost, struct list_head *done_q) { struct scsi_cmnd *scmd, *tgtr_scmd, *next; - unsigned int id; + unsigned int id = 0; int rtn; - for (id = 0; id <= shost->max_id; id++) { + do { tgtr_scmd = NULL; list_for_each_entry(scmd, work_q, eh_entry) { if (id == scmd_id(scmd)) { @@ -1076,8 +1076,18 @@ static int scsi_eh_target_reset(struct Scsi_Host *shost, break; } } + if (!tgtr_scmd) { + /* not one exactly equal; find the next highest */ + list_for_each_entry(scmd, work_q, eh_entry) { + if (scmd_id(scmd) > id && + (!tgtr_scmd || + scmd_id(tgtr_scmd) > scmd_id(scmd))) + tgtr_scmd = scmd; + } + } if (!tgtr_scmd) - continue; + /* no more commands, that's it */ + break; SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Sending target reset " "to target %d\n", @@ -1096,7 +1106,8 @@ static int scsi_eh_target_reset(struct Scsi_Host *shost, " failed target: " "%d\n", current->comm, id)); - } + id++; + } while(id != 0); return list_empty(work_q); }