All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michaelc@cs.wisc.edu>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
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:31:14 -0500	[thread overview]
Message-ID: <4E39CC32.70305@cs.wisc.edu> (raw)
In-Reply-To: <1312410128.2855.94.camel@mulgrave>

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.

  reply	other threads:[~2011-08-03 22:31 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 [this message]
2011-08-03 22:36     ` James Bottomley
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=4E39CC32.70305@cs.wisc.edu \
    --to=michaelc@cs.wisc.edu \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --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 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.