All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Patrick Mansfield <patmans@us.ibm.com>,
	James Bottomley <James.Bottomley@SteelEye.com>,
	SCSI development list <linux-scsi@vger.kernel.org>
Subject: Re: Device flags: use_10_for_rw and use_10_for_ms
Date: Tue, 29 Nov 2005 21:03:34 +0100	[thread overview]
Message-ID: <20051129200334.GB15804@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0511281626460.4796-100000@iolanthe.rowland.org>

On Mon, Nov 28 2005, Alan Stern wrote:
> Patrick and James:
> 
> There are a couple of problems with the implementation of the 
> use_10_for_rw and use_10_for_ms flags.
> 
> The easy problem is that use_10_for_rw is implemented twice: once in 
> sd.c:sd_rw_intr and once in scsi_lib.c:scsi_io_completion.  The obvious 
> fix is to remove of them.  Since scsi_io_completion is more general, it 
> makes sense to leave the code there and remove it from sd.c.
> 
> The hard problem is that sometimes devices return an ILLEGAL_REQUEST sense
> key when they shouldn't.  I posted an example a week or two ago; what
> happened was the use_10_for_rw flag got turned off and from then on only
> 6-byte commands were used (and of course the device failed to recognize
> them).
> 
> Clearly we need a mechanism for going the other way: when a 6-byte command 
> gets ILLEGAL_REQUEST sense, turn the use_10_for_xxx flag back on.  The 
> difficulty is that this will cause an infinite retry loop if the device 
> doesn't like either form of the command.
> 
> Is there a standard way to limit the number of retries for these cases in 
> scsi_io_completion?  The code pathway involves getting rid of the 
> scsi_cmnd and keeping only the struct request, so I don't know where an 
> appropriate place would be to store the retry counter.
> 
> Any ideas?

How about just improving the check for correctly failed 10-byte command,
so we only clear the flag for the right reason? I think your problem is
likely due to the check being too relaxed right now.

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index ce9d73a..1f27827 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -884,7 +884,8 @@ void scsi_io_completion(struct scsi_cmnd
 			* system where READ CAPACITY failed, we may have read
 			* past the end of the disk.
 		 	*/
-			if (cmd->device->use_10_for_rw &&
+			if ((cmd->device->use_10_for_rw &&
+			    sshdr.asc == 0x20 && sshdr.ascq == 0x00) &&
 			    (cmd->cmnd[0] == READ_10 ||
 			     cmd->cmnd[0] == WRITE_10)) {
 				cmd->device->use_10_for_rw = 0;

-- 
Jens Axboe


  reply	other threads:[~2005-11-29 20:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-28 21:43 Device flags: use_10_for_rw and use_10_for_ms Alan Stern
2005-11-29 20:03 ` Jens Axboe [this message]
2005-11-29 21:23   ` Alan Stern
2005-11-29 22:48     ` Patrick Mansfield
2005-11-30 15:46       ` Alan Stern
2005-11-30  8:08     ` Jens Axboe
2005-11-30 14:46       ` James Bottomley
2005-11-30 14:51         ` Jens Axboe

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=20051129200334.GB15804@suse.de \
    --to=axboe@suse.de \
    --cc=James.Bottomley@SteelEye.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=patmans@us.ibm.com \
    --cc=stern@rowland.harvard.edu \
    /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.