All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] SCSI: Correct UA being ignored when notifying of media-changed
@ 2011-08-03 13:39 Rob Evers
  2011-08-03 22:06 ` Mike Christie
  2011-08-03 22:22 ` James Bottomley
  0 siblings, 2 replies; 10+ messages in thread
From: Rob Evers @ 2011-08-03 13:39 UTC (permalink / raw)
  To: linux-scsi; +Cc: michaelc, James.Bottomley

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;
+				}
 			return NEEDS_RETRY;
 		}
 		/*
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [RFC PATCH] SCSI: Correct UA being ignored when notifying of media-changed
  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
  1 sibling, 0 replies; 10+ messages in thread
From: Mike Christie @ 2011-08-03 22:06 UTC (permalink / raw)
  To: Rob Evers; +Cc: linux-scsi, James.Bottomley

On 08/03/2011 08:39 AM, 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;
> +				}

I think this 'if' block got tabbed over once too many times.

>  			return NEEDS_RETRY;
>  		}
>  		/*


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC PATCH] SCSI: Correct UA being ignored when notifying of media-changed
  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
  1 sibling, 1 reply; 10+ messages in thread
From: James Bottomley @ 2011-08-03 22:22 UTC (permalink / raw)
  To: Rob Evers; +Cc: linux-scsi, michaelc

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.

Surely we want this at the end of the UA handling clause?

James



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC PATCH] SCSI: Correct UA being ignored when notifying of media-changed
  2011-08-03 22:22 ` James Bottomley
@ 2011-08-03 22:31   ` Mike Christie
  2011-08-03 22:36     ` James Bottomley
  0 siblings, 1 reply; 10+ messages in thread
From: Mike Christie @ 2011-08-03 22:31 UTC (permalink / raw)
  To: James Bottomley; +Cc: Rob Evers, linux-scsi

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC PATCH] SCSI: Correct UA being ignored when notifying of media-changed
  2011-08-03 22:31   ` Mike Christie
@ 2011-08-03 22:36     ` James Bottomley
  2011-08-03 23:14       ` Mike Christie
  2011-08-08 22:50       ` TARUISI Hiroaki
  0 siblings, 2 replies; 10+ messages in thread
From: James Bottomley @ 2011-08-03 22:36 UTC (permalink / raw)
  To: Mike Christie; +Cc: Rob Evers, linux-scsi

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC PATCH] SCSI: Correct UA being ignored when notifying of media-changed
  2011-08-03 22:36     ` James Bottomley
@ 2011-08-03 23:14       ` Mike Christie
  2011-08-08 22:50       ` TARUISI Hiroaki
  1 sibling, 0 replies; 10+ messages in thread
From: Mike Christie @ 2011-08-03 23:14 UTC (permalink / raw)
  To: James Bottomley; +Cc: Rob Evers, linux-scsi

On 08/03/2011 05:36 PM, James Bottomley wrote:
> 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.
> 

Yeah, ok. Agree with you.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC PATCH] SCSI: Correct UA being ignored when notifying of media-changed
  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
  1 sibling, 1 reply; 10+ messages in thread
From: TARUISI Hiroaki @ 2011-08-08 22:50 UTC (permalink / raw)
  To: James.Bottomley; +Cc: michaelc, revers, linux-scsi

Hi James,

I posted a patch (as below) last year about this.
  http://www.kerneltrap.org/mailarchive/linux-scsi/2010/12/22/6887895

I intended to distinguish UA caused by media change from UA caused by
other reasons like resetting a device. First, it should be notified to upper
layer driver, sr, but the other must be retried as scsi_error.c coded.

At least SCSI driver should not squash all UAs, I think.

-- 
taruisi

(2011/08/04 7:36), James Bottomley wrote:
> 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
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC PATCH] SCSI: Correct UA being ignored when notifying of media-changed
  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
  0 siblings, 1 reply; 10+ messages in thread
From: James Bottomley @ 2011-08-09 15:22 UTC (permalink / raw)
  To: TARUISI Hiroaki; +Cc: michaelc, revers, linux-scsi

On Tue, 2011-08-09 at 07:50 +0900, TARUISI Hiroaki wrote:
> Hi James,
> 
> I posted a patch (as below) last year about this.
>   http://www.kerneltrap.org/mailarchive/linux-scsi/2010/12/22/6887895
> 
> I intended to distinguish UA caused by media change from UA caused by
> other reasons like resetting a device. First, it should be notified to upper
> layer driver, sr, but the other must be retried as scsi_error.c coded.
> 
> At least SCSI driver should not squash all UAs, I think.

Well ... the spec says the device should stack UAs in this event.
However, I can totally believe that a broken CD would fail on this
front.

If Mike and Rob can verify that it's realy asc/ascq 0x28/0x0 that the CD
is emitting, I'd be happy to put the patch in (with a nice big comment
explaining what's being done and why over the if() check rather than
updating the global comment).

James



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] SCSI: Prevent from retrying with expecting_cc_ua in case of disk change.
  2011-08-09 15:22         ` James Bottomley
@ 2011-08-11 11:25           ` TARUISI Hiroaki
  0 siblings, 0 replies; 10+ messages in thread
From: TARUISI Hiroaki @ 2011-08-11 11:25 UTC (permalink / raw)
  To: James.Bottomley; +Cc: michaelc, revers, linux-scsi

Hi James,

Thanks for your comment.
Actually, Rob and I are focusing to the same problem.
And I have a dvd drive of that kind.

To confirm ASC,ASCQ in this case, I added some printk
like this.
----
        * so that we can deal with it there.
        */
       if (scmd->device->expecting_cc_ua) {
               printk("scsi_check_sense: expecting_cc_ua=on"
                      " unit_attention asc=%02x ascq=%02x\n",
                      sshdr.asc, sshdr.ascq);
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
               scmd->device->expecting_cc_ua = 0;
               return SCSI_MLQUEUE_DIS_DEV_RETRY;
       }
       /*
        * if the device is in the process of becoming ready, we
        * should retry.
        */
----
And I created boot dvd, booted the system with that in
rescue mode, changed the media after boot and read or write
that media, then, I could see these messages.
----
<6>Adding 4095992k swap on /dev/VolGroup00/LogVol01.  Priority:-1 extents:1 across:4095996k
<4>scsi_check_sense: expecting_cc_ua=on unit_attention asc=28 ascq=00
<4>end_request: I/O error, dev sr0, sector 7432832
----

As message says, my dvd drive reports media change sense and
as the result end_request I/O error is caused.
Surely this drive may be naughty, but we should know what kind of
UA and treat it.


---
 drivers/scsi/scsi_error.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index a4b9cdb..158ba46 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -293,8 +293,15 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
                 * so that we can deal with it there.
                 */
                if (scmd->device->expecting_cc_ua) {
-                       scmd->device->expecting_cc_ua = 0;
-                       return NEEDS_RETRY;
+               /*
+                * Because some device does not queue unit attentions correctly,
+                * we carefully check additional sense code and qualifier
+                * so as not to squash media change unit attention.
+                */
+                       if (sshdr.asc != 0x28 || sshdr.ascq != 0x00) {
+                               scmd->device->expecting_cc_ua = 0;
+                               return NEEDS_RETRY;
+                       }
                }
                /*
                 * if the device is in the process of becoming ready, we
--
1.6.5

(2011/08/10 0:22), James Bottomley wrote:
> On Tue, 2011-08-09 at 07:50 +0900, TARUISI Hiroaki wrote:
>> Hi James,
>>
>> I posted a patch (as below) last year about this.
>>   http://www.kerneltrap.org/mailarchive/linux-scsi/2010/12/22/6887895
>>
>> I intended to distinguish UA caused by media change from UA caused by
>> other reasons like resetting a device. First, it should be notified to upper
>> layer driver, sr, but the other must be retried as scsi_error.c coded.
>>
>> At least SCSI driver should not squash all UAs, I think.
> 
> Well ... the spec says the device should stack UAs in this event.
> However, I can totally believe that a broken CD would fail on this
> front.
> 
> If Mike and Rob can verify that it's realy asc/ascq 0x28/0x0 that the CD
> is emitting, I'd be happy to put the patch in (with a nice big comment
> explaining what's being done and why over the if() check rather than
> updating the global comment).
> 
> James
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 
-- 
taruisi


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] SCSI: Prevent from retrying with expecting_cc_ua in case of disk change.
@ 2010-12-22  6:53 TARUISI Hiroaki
  0 siblings, 0 replies; 10+ messages in thread
From: TARUISI Hiroaki @ 2010-12-22  6:53 UTC (permalink / raw)
  To: linux-scsi

Hi,

 I have found a following trouble.

   1. Boot with a particular usb DVD-RAM drive with RHEL boot disk
      in rescue mode.
   2. Change disk to DVD-RAM (whatever disk may ok which is bigger
      capacity than previous boot disk)
   3. execute ioctl(BLKGETSIZE[64]).
   4. We get the size of boot disk. (not one of DVD-RAM)

  Actually, I replaced to DVD-RAM disk with ext2 filesystem and check
  it with fsck, I get these nice error message.

      The filesystem size (according to the superblock) is xxxx blocks
      The physical size of the device is yyyy blocks
      Either the superblock or the partition table is likely to be corrupt!
      Abort?

  I found this problem is caused by retry logic of scsi driver.
  scsi driver retries i-o in case of unit attention with expecting_cc_ua=1
  even if the unit attention means disk change. So, sr driver loses unit
  attention, and also loses disk change event.

  (As for expecting_cc_ua=1, this was set because of a hardware bug and
   this is also another cause. I wonder why this bit is off only when
   unit attention or not ready. It should be off at the first i-o after
   reset operation, I think...)

  I made a simple patch for this problem. Could someone check this patch?

Regards,
taruisi

Signed-off-by: TARUISI Hiroaki <taruishi.hiroak@jp.fujitsu.com>
---
 drivers/scsi/scsi_error.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 30ac116..fd93145 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -285,13 +285,15 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
    case UNIT_ATTENTION:
        /*
         * if we are expecting a cc/ua because of a bus reset that we
-        * performed, treat this just as a retry.  otherwise this is
-        * information that we should pass up to the upper-level driver
-        * so that we can deal with it there.
+        * performed, treat this just as a retry except a case of disk
+        * change.  otherwise this is information that we should pass up
+        * to the upper-level driver so that we can deal with it there.
         */
        if (scmd->device->expecting_cc_ua) {
-           scmd->device->expecting_cc_ua = 0;
-           return NEEDS_RETRY;
+           if (sshdr.asc != 0x28 || sshdr.ascq != 0x00) {
+               scmd->device->expecting_cc_ua = 0;
+               return NEEDS_RETRY;
+           }
        }
        /*
         * if the device is in the process of becoming ready, we
-- 
1.4.4.4


-- 
taruisi


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-08-11 11:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
  -- strict thread matches above, loose matches on Subject: below --
2010-12-22  6:53 TARUISI Hiroaki

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.