From: James Bottomley <James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
To: SCSI development list
<linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: USB list <linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Alan Stern
<stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
Subject: [PATCH 3/3] [SCSI] Fix command result state propagation
Date: Fri, 28 Mar 2014 10:51:15 -0700 [thread overview]
Message-ID: <1396029075.15365.33.camel@dabdike> (raw)
In-Reply-To: <1396028874.15365.30.camel@dabdike>
From: Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
We're seeing a case where the contents of scmd->result isn't being reset after
a SCSI command encounters an error, is resubmitted, times out and then gets
handled. The error handler acts on the stale result of the previous error
instead of the timeout. Fix this by properly zeroing the scmd->status before
the command is resubmitted.
Signed-off-by: Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
Signed-off-by: James Bottomley <JBottomley-MU7nAjRaF3makBO8gow8eQ@public.gmane.org>
---
drivers/scsi/scsi_error.c | 1 +
drivers/scsi/scsi_lib.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 221a5bc..335eaf4 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -927,6 +927,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses,
memset(scmd->cmnd, 0, BLK_MAX_CDB);
memset(&scmd->sdb, 0, sizeof(scmd->sdb));
scmd->request->next_rq = NULL;
+ scmd->result = 0;
if (sense_bytes) {
scmd->sdb.length = min_t(unsigned, SCSI_SENSE_BUFFERSIZE,
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 5681c05..b1f4867 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -137,6 +137,7 @@ static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, int unbusy)
* lock such that the kblockd_schedule_work() call happens
* before blk_cleanup_queue() finishes.
*/
+ cmd->result = 0;
spin_lock_irqsave(q->queue_lock, flags);
blk_requeue_request(q, cmd->request);
kblockd_schedule_work(q, &device->requeue_work);
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-03-28 17:51 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-28 17:47 [PATCH 0/3] Fix USB deadlock caused by SCSI error handling James Bottomley
2014-03-28 17:49 ` [PATCH 1/3] [SCSI] Fix abort state memory problem James Bottomley
2014-03-31 6:58 ` Hannes Reinecke
2014-03-31 13:06 ` Alan Stern
2014-03-28 17:50 ` [PATCH 2/3] [SCSI] Fix spurious request sense in error handling James Bottomley
2014-03-31 6:59 ` Hannes Reinecke
2014-03-28 17:51 ` James Bottomley [this message]
2014-03-31 7:00 ` [PATCH 3/3] [SCSI] Fix command result state propagation Hannes Reinecke
2014-03-28 19:29 ` [PATCH 0/3] Fix USB deadlock caused by SCSI error handling Alan Stern
2014-03-31 7:22 ` Hannes Reinecke
2014-03-31 13:33 ` Alan Stern
2014-03-31 14:37 ` Hannes Reinecke
[not found] ` <53397DAE.9010801-l3A5Bk7waGM@public.gmane.org>
2014-03-31 15:03 ` James Bottomley
2014-03-31 22:41 ` Alan Stern
[not found] ` <1396278224.3152.26.camel-sFMDBYUN5F8GjUHQrlYNx2Wm91YjaHnnhRte9Li2A+AAvxtiuMwx3w@public.gmane.org>
2014-04-01 6:14 ` Hannes Reinecke
2014-03-31 22:29 ` Alan Stern
2014-04-01 15:37 ` Hannes Reinecke
[not found] ` <533ADD26.1030300-l3A5Bk7waGM@public.gmane.org>
2014-04-01 21:28 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1404011718350.7652-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-04-02 6:03 ` Hannes Reinecke
2014-04-07 15:26 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1404071125220.20747-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-04-09 17:42 ` Hannes Reinecke
[not found] ` <53458680.4090500-l3A5Bk7waGM@public.gmane.org>
2014-04-09 18:02 ` Alan Stern
2014-04-10 10:58 ` Andreas Reis
2014-04-10 11:37 ` Hannes Reinecke
2014-04-10 12:26 ` Andreas Reis
2014-04-10 12:29 ` Hannes Reinecke
2014-04-10 15:31 ` Alan Stern
2014-04-10 17:52 ` Hannes Reinecke
[not found] ` <5346DA43.4010603-l3A5Bk7waGM@public.gmane.org>
2014-04-10 20:36 ` James Bottomley
2014-04-11 5:52 ` Hannes Reinecke
[not found] ` <53468297.1040909-l3A5Bk7waGM@public.gmane.org>
2014-04-11 19:08 ` Andreas Reis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1396029075.15365.33.camel@dabdike \
--to=james.bottomley-d9phhud1jfjcxq6kfmz53/egyhegw8jk@public.gmane.org \
--cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox