maybe_retry:
- if ((++scmd->retries) < scmd->allowed) {
+ /* we requeue for retry because the error was retryable, and
+ * the request was not marked fast fail. Note that above,
+ * even if the request is marked fast fail, we still requeue
+ * for queue congestion conditions (QUEUE_FULL or BUSY) */
+ if ((++scmd->retries) < scmd->allowed
+ && !blk_noretry_request(scmd->request)) {
return NEEDS_RETRY;
} else {
/*
* to queue the remainder of them.
*/
if (end_that_request_first(req, uptodate, sectors)) {
- if (requeue) {
- /*
- * Bleah. Leftovers again. Stick the leftovers in
- * the front of the queue, and goose the queue again.
- */
- scsi_requeue_command(q, cmd);
+ int leftover = req->hard_nr_sectors - sectors;
+
+ /* kill remainder if no retrys */
+ if (!uptodate && blk_noretry_request(req))
+ end_that_request_first(req, 0, leftover);
+ else {
+ if (requeue)
+ /*
+ * Bleah. Leftovers again. Stick the
+ * leftovers in the front of the
+ * queue, and goose the queue again.
+ */
+ scsi_requeue_command(q, cmd);
+
+ return cmd;
}
- return cmd;
}
add_disk_randomness(req->rq_disk);