From: Hannes Reinecke <hare@suse.de>
To: James Bottomley <jbottomley@parallels.com>
Cc: linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
Mike Christie <michaelc@cs.wisc.edu>, Tejun Heo <tj@kernel.org>
Subject: [PATCH] scsi: Double completion on retry
Date: Thu, 2 May 2013 10:31:02 +0200 [thread overview]
Message-ID: <1367483462-22576-1-git-send-email-hare@suse.de> (raw)
When blk_end_request() returns 'false' in scsi_end_request the
request is invalid after blk_end_request_all(). So we must not
return the then stale request pointer. Doing so will result
in a potential double completion.
And we should be calling scsi_release_buffers() before
blk_end_request_all().
Cc: Mike Christie <michaelc@cs.wisc.edu>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index c31187d..8dba66b 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -581,9 +581,11 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int error,
*/
if (blk_end_request(req, error, bytes)) {
/* kill remainder if no retrys */
- if (error && scsi_noretry_cmd(cmd))
+ if (error && scsi_noretry_cmd(cmd)) {
+ scsi_release_buffers(cmd);
blk_end_request_all(req, error);
- else {
+ cmd = NULL;
+ } else {
if (requeue) {
/*
* Bleah. Leftovers again. Stick the
next reply other threads:[~2013-05-02 8:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-02 8:31 Hannes Reinecke [this message]
2013-05-02 8:34 ` [PATCH] scsi: Double completion on retry Hannes Reinecke
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=1367483462-22576-1-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=jbottomley@parallels.com \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
--cc=tj@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.