linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Mike Christie <michaelc@cs.wisc.edu>
Cc: Rob Evers <revers@redhat.com>, linux-scsi@vger.kernel.org
Subject: Re: [RFC PATCH] SCSI: Correct UA being ignored when notifying of media-changed
Date: Wed, 03 Aug 2011 17:36:39 -0500	[thread overview]
Message-ID: <1312410999.2855.97.camel@mulgrave> (raw)
In-Reply-To: <4E39CC32.70305@cs.wisc.edu>

On Wed, 2011-08-03 at 17:31 -0500, Mike Christie wrote:
> On 08/03/2011 05:22 PM, James Bottomley wrote:
> > On Wed, 2011-08-03 at 09:39 -0400, Rob Evers wrote:
> >> Unit attention commands are getting ignored when a dvd is
> >> replaced, resulting in errors when accessing the new dvd.
> >>
> >> This problem occurred when a system is booted in rescue
> >> mode via dvd and the dvd is then replaced with another dvd.
> >> Subsequent commands to a filesystem on the dvd, such as
> >> 'fsck' and 'restore' report errors.
> >>
> >> Solution suggested by Mike Christie.
> >>
> >> Signed-off-by: Rob Evers <revers@redhat.com>
> >> ---
> >>  drivers/scsi/scsi_error.c |    4 ++++
> >>  1 files changed, 4 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> >> index a4b9cdb..725cc11 100644
> >> --- a/drivers/scsi/scsi_error.c
> >> +++ b/drivers/scsi/scsi_error.c
> >> @@ -294,6 +294,10 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
> >>  		 */
> >>  		if (scmd->device->expecting_cc_ua) {
> >>  			scmd->device->expecting_cc_ua = 0;
> >> +				if (sdev->removable) {
> >> +					sdev->changed = 1;
> >> +					return SUCCESS;
> >> +				}
> > 
> > Are you sure about this?  We only set expecting_cc_ua if the device was
> > reset in error handling ... and there we definitely *don't* want to
> > trigger a medium change.
> > 
> 
> What is happening is that we have a quirky device, and when you switch
> CD/DVDs the first command times out, so the scsi error handler runs.
> That is why the above code was modified. Before the patch the scsi layer
> would just retry the IO, and sr would not see the sense and so it would
> not detect the media changed. So the above code was meant to work like
> UA code in scsi_io_completion.

The SCSI standard requires all SCSI devices to return UA after a reset
(that's the reason for the code).  So, if I put this patch in, every
removable device would be flagged as having changed media if we go into
an error handling situation and reset it.  I don't think that's a good
idea to fix a single non-standard CD.

James



  reply	other threads:[~2011-08-03 22:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-03 13:39 [RFC PATCH] SCSI: Correct UA being ignored when notifying of media-changed Rob Evers
2011-08-03 22:06 ` Mike Christie
2011-08-03 22:22 ` James Bottomley
2011-08-03 22:31   ` Mike Christie
2011-08-03 22:36     ` James Bottomley [this message]
2011-08-03 23:14       ` Mike Christie
2011-08-08 22:50       ` TARUISI Hiroaki
2011-08-09 15:22         ` James Bottomley
2011-08-11 11:25           ` [PATCH] SCSI: Prevent from retrying with expecting_cc_ua in case of disk change TARUISI Hiroaki

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=1312410999.2855.97.camel@mulgrave \
    --to=james.bottomley@hansenpartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=revers@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).