From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Jinpu Wang <jinpu.wang@profitbricks.com>,
Hannes Reinecke <hare@suse.de>,
Bart Van Assche <bart.vanassche@sandisk.com>,
Christoph Hellwig <hch@infradead.org>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Sebastian Parschauer <s.parschauer@gmx.de>,
linux-scsi@vger.kernel.org
Subject: [PATCH] scsi_lib: correctly retry failed zero length REQ_TYPE_FS commands
Date: Fri, 13 May 2016 12:04:06 -0700 [thread overview]
Message-ID: <1463166246.2291.84.camel@HansenPartnership.com> (raw)
When SCSI was written, all commands coming from the filesystem
(REQ_TYPE_FS commands) had data. This meant that our signal for
needing to complete the command was the number of bytes completed being
equal to the number of bytes in the request. Unfortunately, with the
advent of flush barriers, we can now get zero length REQ_TYPE_FS
commands, which confuse this logic because they satisfy the condition
every time. This means they never get retried even for retryable
conditions, like UNIT ATTENTION because we complete them early assuming
they're done. Fix this by special casing the early completion
condition to recognise zero length commands with errors and let them
drop through to the retry code.
Reported-by: Sebastian Parschauer <s.parschauer@gmx.de>
Signed-off-by: James E.J. Bottomley <jejb@linux.vnet.ibm.com>
---
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 8106515..f704d02 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -911,9 +911,12 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
}
/*
- * If we finished all bytes in the request we are done now.
+ * special case: failed zero length commands always need to
+ * drop down into the retry code. Otherwise, if we finished
+ * all bytes in the request we are done now.
*/
- if (!scsi_end_request(req, error, good_bytes, 0))
+ if (!(blk_rq_bytes(req) == 0 && error) &&
+ !scsi_end_request(req, error, good_bytes, 0))
return;
/*
next reply other threads:[~2016-05-13 19:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-13 19:04 James Bottomley [this message]
2016-05-17 9:28 ` [PATCH] scsi_lib: correctly retry failed zero length REQ_TYPE_FS commands Johannes Thumshirn
2016-05-17 9:35 ` Jinpu Wang
2016-05-17 9:29 ` Jinpu Wang
2016-05-20 2:06 ` Martin K. Petersen
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=1463166246.2291.84.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=bart.vanassche@sandisk.com \
--cc=hare@suse.de \
--cc=hch@infradead.org \
--cc=jinpu.wang@profitbricks.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=s.parschauer@gmx.de \
/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.