linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* BUG in kernel: Wrong Handling of USB HDD’s in scsiglue(slave_configure) and scsi/sd(sd_read_cache_type)
@ 2011-09-28 15:42 Amit Sahrawat
  2011-09-28 15:54 ` BUG in kernel: Wrong Handling of USB HDD?s " Christoph Hellwig
  2011-09-28 15:57 ` BUG in kernel: Wrong Handling of USB HDD’s " Amit Sahrawat
  0 siblings, 2 replies; 17+ messages in thread
From: Amit Sahrawat @ 2011-09-28 15:42 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel

When a USB HDD is connected to the device, it invokes slave_configure
to configure the USB HDD. In this function, whenever there is a SCSI
device of type TYPE_DISK, it sets:
	/* A number of devices have problems with MODE SENSE for
		 * page x08, so we will skip it. */
		sdev->skip_ms_page_8 = 1;

Now, as a part of SCSI device probing, in the function
sd_revalidate_disk()-->sd_read_cache_type(), there is a condition
if (sdp->skip_ms_page_8)
		goto defaults;
which becomes always true for all the USB HDD’s – the net result is
that the Write Cache is never considered for USB HDD(WCE = 0) –
“Assuming drive cache: write through”

What’s more – the QUEUE ordering which is marked for WCE=0 is
QUEUE_ORDERED_DRAIN, instead of QUEUE_ORDERED_DRAIN_FLUSH
This means there is no flushing of USB HDD internal cache (although
SYNCHRONIZE_CACHE is implemented as passed as command in
sd_prepare_flush) – queue_flush()(called in function
blk_do_ordered()-->start_ordered()) does not gets called in case of
QUEUE_ORDERED_DRAIN.

This causes a serious impact on USB HDD’s.

Please let me know in case I have missed something in my observations.

Thanks & Regards,
Amit Sahrawat

^ permalink raw reply	[flat|nested] 17+ messages in thread
* Re: Re: Re: BUG in kernel: Wrong Handling of USB HDD’s in scsiglue(slave_configure) and scsi/sd(sd_read_cache_type)
@ 2011-10-03 14:25 Alan Stern
  2011-10-03 16:06 ` Douglas Gilbert
  0 siblings, 1 reply; 17+ messages in thread
From: Alan Stern @ 2011-10-03 14:25 UTC (permalink / raw)
  To: Amit Sahrawat
  Cc: James Bottomley, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Christoph Hellwig

On Mon, 3 Oct 2011, Amit Sahrawat wrote:

> Hi,
> 
> Please find the USB Analyzer - logs for '6' USB based Mass Storage
> devices attached.

Too bad the analyzer log presents only the response, not the command.

> So, only for one of the USB HDD(Seagate - Free Agent), the response
> obtained is correct.

I don't understand the format of the Seagate Free Agent MODE SENSE
data.  Maybe someone else can interpret it; here it is for reference:

SCSI Op(3) ADDR(4) Tag(0x00000004) SCSI CDB MODE SENSE(6)
_______| Data(
__ 000: 1C 00 00 00 86 0B 00 02 00 00 12 A1 9E B0 3C 01 00 1A 0A 00 01 00 00 00 00 00 00 0B B8 00 00 00 
__ 032: 00 00 00 00 1A 0A 00 01 00 00 00 00 00 00 0B B8 A2 06 00 00 00 00 00 00 78 20 55 53 42 32 2E 30 
__ 064: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7F FF 00 00 00 00 80 FA 0B C2 50 21 4E 41 30 42 
__ 096: 36 58 33 4C 00 30 00 00 00 32 43 46 45 39 42 00 70 F5 12 00 74 FF 00 00 00 00 00 00 00 00 00 00 
__ 128: 3C 00 00 0B B8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02 50 01 
__ 160: 46 72 65 65 41 67 65 6E 74 20 47 6F 46 6C 65 78 10 50 11 46 72 65 65 41 67 65 6E 74 20 47 6F 46)

For the other devices this seems clear enough.  In most of the cases,
the data doesn't include the Caching page.  The Samsung and Transcend
devices _do_ provide their Caching pages, and in both of them the data
says that write caching is disabled.  (In the Samsung case this is
wrong undoubtedly because of the JMicron bridge -- JMicron's firmware
is notoriously buggy.)

If you can suggest a robust way of determining whether or not a drive 
supports SAT (one which won't cause non-supporting devices to crash), 
it could be added.  In the meantime, I'm not sure what else we can do.

Would it make sense to assume write caching is present and enabled if 
the drive does not provide a Caching page?

Alan Stern

--
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

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

end of thread, other threads:[~2011-10-03 16:06 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-28 15:42 BUG in kernel: Wrong Handling of USB HDD’s in scsiglue(slave_configure) and scsi/sd(sd_read_cache_type) Amit Sahrawat
2011-09-28 15:54 ` BUG in kernel: Wrong Handling of USB HDD?s " Christoph Hellwig
2011-09-28 15:57 ` BUG in kernel: Wrong Handling of USB HDD’s " Amit Sahrawat
2011-09-28 21:29   ` James Bottomley
2011-09-29  9:19     ` Amit Sahrawat
2011-09-29 18:27       ` James Bottomley
2011-09-29 18:31         ` James Bottomley
2011-09-30  6:56           ` Amit Sahrawat
2011-09-30  7:06             ` NamJae Jeon
2011-09-30 12:18             ` James Bottomley
2011-09-30 17:53               ` Amit Sahrawat
2011-09-30 17:56                 ` Amit Sahrawat
2011-09-30 18:11                   ` James Bottomley
2011-09-30 18:30                     ` Amit Sahrawat
2011-09-30 18:17                   ` Alan Stern
2011-09-30 18:36                     ` Amit Sahrawat
  -- strict thread matches above, loose matches on Subject: below --
2011-10-03 14:25 Alan Stern
2011-10-03 16:06 ` Douglas Gilbert

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).