public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthieu CASTET <matthieu.castet-ITF29qwbsa/QT0dZR+AlfA@public.gmane.org>
To: Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
Cc: linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	James Bottomley
	<James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>,
	TARUISI Hiroaki
	<taruishi.hiroak-+CUm20s59erQFUHtdCDX3A@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Buffer I/O error after s2ram with usb storage
Date: Fri, 29 Aug 2014 18:12:01 +0200	[thread overview]
Message-ID: <20140829181201.277e699d@parrot.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1408271051160.1460-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>

Le Wed, 27 Aug 2014 10:54:53 -0400,
Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org> a écrit :

> On Wed, 27 Aug 2014, Matthieu CASTET wrote:
> 
> > Ping
> > 
> > I have got also a problem with a usb sdcard reader (without power cut
> > during suspend)
> 
> > > > The usb storage driver call scsi_report_bus_reset after device reset,
> > > > but because of commit dfcf7775 <4>, we don't ignore unit attention if
> > > > "sshdr.asc == 0x28 && sshdr.ascq == 0x00" ("Not-ready to ready").
> > > > 
> > > > If dfcf7775 is reverted there is no more Buffer I/O error.
> > > > 
> > > > Is that possible to find a way to restore the behavior before dfcf7775
> > > > commit (no Buffer I/O error after device reset) after a suspend to ram ?
> 
> Since that commit was written to fix a problem with certain cdrom
> drives, maybe we would work around the issue by modifying the commit.  
> Have it go back to the original behavior if the device isn't a cdrom 
> drive.
> 
> That's not a complete fix (it won't help when a CD drive is attached 
> via USB), but maybe it's better than nothing.
> 
Ok,

note to handle all case we need also to filter unit_attention in
scsi_test_unit_ready. Otherwise DISK_EVENT_MEDIA_CHANGE event is set and check_disk_change will invalidate vfs cache.


Matthieu

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 2bc0362..e994061 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2030,8 +2030,12 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries,
 		result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sshdr,
 					  timeout, retries, NULL);
 		if (sdev->removable && scsi_sense_valid(sshdr) &&
-		    sshdr->sense_key == UNIT_ATTENTION)
-			sdev->changed = 1;
+		    sshdr->sense_key == UNIT_ATTENTION) {
+			if (sdev->expecting_cc_ua)
+				sdev->expecting_cc_ua = 0;
+			else
+				sdev->changed = 1;
+		}
 	} while (scsi_sense_valid(sshdr) &&
 		 sshdr->sense_key == UNIT_ATTENTION && --retries);
 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2014-08-29 16:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-22 14:01 Buffer I/O error after s2ram with usb storage Matthieu CASTET
2014-04-28 13:01 ` Matthieu CASTET
     [not found]   ` <20140428150139.0e10dfd9-ITF29qwbsa/QT0dZR+AlfA@public.gmane.org>
2014-08-27  8:40     ` Matthieu CASTET
2014-08-27 14:06       ` Douglas Gilbert
2014-08-27 14:57         ` Alan Stern
2014-08-27 14:54       ` Alan Stern
     [not found]         ` <Pine.LNX.4.44L0.1408271051160.1460-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-08-29 16:12           ` Matthieu CASTET [this message]

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=20140829181201.277e699d@parrot.com \
    --to=matthieu.castet-itf29qwbsa/qt0dzr+alfa@public.gmane.org \
    --cc=James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
    --cc=taruishi.hiroak-+CUm20s59erQFUHtdCDX3A@public.gmane.org \
    /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