From: Hans de Goede <hdegoede@redhat.com>
To: Ben Hutchings <ben@decadent.org.uk>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
torvalds@linux-foundation.org, akpm@linux-foundation.org,
alan@lxorguk.ukuu.org.uk, Alan Stern <stern@rowland.harvard.edu>,
"James E.J. Bottomley" <JBottomley@parallels.com>,
Matthew Dharm <mdharm-usb@one-eyed-alien.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [ 38/48] SCSI & usb-storage: add try_rc_10_first flag
Date: Mon, 02 Jul 2012 09:10:15 +0200 [thread overview]
Message-ID: <4FF14957.3040007@redhat.com> (raw)
In-Reply-To: <20120701172012.078559139@decadent.org.uk>
Hi,
This patch is a better fix for the issue first fixed by:
"usb-storage: Add 090c:1000 to unusal-devs", so the same applies to
this patch, let me quote my reply to the stable-review for that patch:
"I'm not sure if this is needed with 3.2, it is needed with 3.4 because
recently the usb-storage driver was changed to report the supported
scsi level as reported by the device, rather then always report a
scsi level of 2. This change causes sd.c to try READ_CAPACITY(16)
first, which foobars up not only this one device, but as it turns
out a lot of others too, so we're working on another fix
(and I believe that 3.2 is unaffected)."
So since 3.2 already tries READ_CAPACITY(10) first, this patch is
not needed. It does not harm either, and if the scsi level reporting
change ever finds its way into 3.2 stable (which it should not
IMHO), then this patch will be needed.
Regards,
Hans
On 07/01/2012 07:20 PM, Ben Hutchings wrote:
> 3.2-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Alan Stern <stern@rowland.harvard.edu>
>
> commit 6a0bdffa0073857870a4ed1b4489762146359eb4 upstream.
>
> Several bug reports have been received recently for USB mass-storage
> devices that don't handle READ CAPACITY(16) commands properly. They
> report bogus sizes, in some cases becoming unusable as a result.
>
> The bugs were triggered by commit
> 09b6b51b0b6c1b9bb61815baf205e4d74c89ff04 (SCSI & usb-storage: add
> flags for VPD pages and REPORT LUNS), which caused usb-storage to stop
> overriding the SCSI level reported by devices. By default, the sd
> driver will try READ CAPACITY(16) first for any device whose level is
> above SCSI_SPC_2.
>
> It seems likely that any device large enough to require the use of
> READ CAPACITY(16) (i.e., 2 TB or more) would be able to handle READ
> CAPACITY(10) commands properly. Indeed, I don't know of any devices
> that don't handle READ CAPACITY(10) properly.
>
> Therefore this patch (as1559) adds a new flag telling the sd driver
> to try READ CAPACITY(10) before READ CAPACITY(16), and sets this flag
> for every USB mass-storage device. If a device really is larger than
> 2 TB, sd will fall back to READ CAPACITY(16) just as it used to.
>
> This fixes Bugzilla #43391.
>
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> Acked-by: Hans de Goede <hdegoede@redhat.com>
> CC: "James E.J. Bottomley" <JBottomley@parallels.com>
> CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
> drivers/scsi/sd.c | 2 ++
> drivers/usb/storage/scsiglue.c | 6 ++++++
> include/scsi/scsi_device.h | 1 +
> 3 files changed, 9 insertions(+)
>
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 6f0a4c6..6f72b80 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -1899,6 +1899,8 @@ static int sd_try_rc16_first(struct scsi_device *sdp)
> {
> if (sdp->host->max_cmd_len < 16)
> return 0;
> + if (sdp->try_rc_10_first)
> + return 0;
> if (sdp->scsi_level > SCSI_SPC_2)
> return 1;
> if (scsi_device_protection(sdp))
> diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
> index a324a5d..11418da 100644
> --- a/drivers/usb/storage/scsiglue.c
> +++ b/drivers/usb/storage/scsiglue.c
> @@ -202,6 +202,12 @@ static int slave_configure(struct scsi_device *sdev)
> if (us->fflags & US_FL_NO_READ_CAPACITY_16)
> sdev->no_read_capacity_16 = 1;
>
> + /*
> + * Many devices do not respond properly to READ_CAPACITY_16.
> + * Tell the SCSI layer to try READ_CAPACITY_10 first.
> + */
> + sdev->try_rc_10_first = 1;
> +
> /* assume SPC3 or latter devices support sense size > 18 */
> if (sdev->scsi_level > SCSI_SPC_2)
> us->fflags |= US_FL_SANE_SENSE;
> diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
> index 6efb2e1..ba96988 100644
> --- a/include/scsi/scsi_device.h
> +++ b/include/scsi/scsi_device.h
> @@ -151,6 +151,7 @@ struct scsi_device {
> SD_LAST_BUGGY_SECTORS */
> unsigned no_read_disc_info:1; /* Avoid READ_DISC_INFO cmds */
> unsigned no_read_capacity_16:1; /* Avoid READ_CAPACITY_16 cmds */
> + unsigned try_rc_10_first:1; /* Try READ_CAPACACITY_10 first */
> unsigned is_visible:1; /* is the device visible in sysfs */
>
> DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
>
>
next prev parent reply other threads:[~2012-07-02 7:10 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20120701172006.535271340@decadent.org.uk>
2012-07-01 17:20 ` [ 01/48] staging:iio:ad7606: Re-add missing scale attribute Ben Hutchings
2012-07-01 17:20 ` [ 02/48] Tools: hv: verify origin of netlink connector message Ben Hutchings
2012-07-01 17:20 ` [ 03/48] edac: avoid mce decoding crash after edac driver unloaded Ben Hutchings
2012-07-01 17:20 ` [ 06/48] hwmon: (applesmc) Limit key length in warning messages Ben Hutchings
2012-07-01 17:20 ` [ 07/48] mm: fix slab->page _count corruption when using slub Ben Hutchings
2012-07-02 23:46 ` Herton Ronaldo Krzesinski
2012-07-02 23:56 ` Herton Ronaldo Krzesinski
2012-07-03 1:17 ` Herton Ronaldo Krzesinski
2012-07-03 20:19 ` Pravin Shelar
2012-07-04 4:36 ` Ben Hutchings
2012-07-01 17:20 ` [ 08/48] mm: pmd_read_atomic: fix 32bit PAE pmd walk vs pmd_populate SMP race condition Ben Hutchings
2012-07-01 17:20 ` [ 10/48] nilfs2: ensure proper cache clearing for gc-inodes Ben Hutchings
2012-07-01 17:20 ` [ 12/48] drm/i915: Finish any pending operations on the framebuffer before disabling Ben Hutchings
2012-07-01 17:20 ` [ 13/48] drm/i915: Remove use of the autoreported ringbuffer HEAD position Ben Hutchings
2012-07-01 17:20 ` [ 15/48] e1000e: Remove special case for 82573/82574 ASPM L1 disablement Ben Hutchings
2012-07-01 22:59 ` Jonathan Nieder
2012-07-01 17:20 ` [ 16/48] drm/i915: Do the fallback non-IRQ wait in ring throttle, too Ben Hutchings
2012-07-01 17:20 ` [ 17/48] staging:rts_pstor:Fix possible panic by NULL pointer dereference Ben Hutchings
2012-07-01 17:20 ` [ 21/48] drm/nouveau/fbcon: using nv_two_heads is not a good idea Ben Hutchings
2012-07-01 17:20 ` [ 29/48] ARM: SAMSUNG: Should check for IS_ERR(clk) instead of NULL Ben Hutchings
2012-07-01 17:20 ` [ 30/48] ath9k_hw: avoid possible infinite loop in ar9003_get_pll_sqsum_dvc Ben Hutchings
2012-07-01 17:20 ` [ 31/48] iwlwifi: remove log_event debugfs file debugging is disabled Ben Hutchings
2012-07-01 17:20 ` [ 32/48] ARM: SAMSUNG: Fix for S3C2412 EBI memory mapping Ben Hutchings
2012-07-01 17:20 ` [ 33/48] USB: option: add id for Cellient MEN-200 Ben Hutchings
2012-07-01 17:20 ` [ 34/48] oprofile: perf: use NR_CPUS instead or nr_cpumask_bits for static array Ben Hutchings
2012-07-01 17:20 ` [ 35/48] drm/i915: Refactor the deferred PM_IIR handling into a single function Ben Hutchings
2012-07-01 17:20 ` [ 36/48] drm/i915: rip out the PM_IIR WARN Ben Hutchings
2012-07-01 17:20 ` [ 37/48] drm/i915: Fix eDP blank screen after S3 resume on HP desktops Ben Hutchings
2012-07-01 17:20 ` [ 38/48] SCSI & usb-storage: add try_rc_10_first flag Ben Hutchings
2012-07-02 7:10 ` Hans de Goede [this message]
2012-07-02 18:52 ` Linus Torvalds
2012-07-02 20:39 ` James Bottomley
2012-07-02 22:23 ` Linus Torvalds
2012-07-03 0:41 ` Matthew Wilcox
2012-07-03 6:18 ` James Bottomley
2012-07-03 15:49 ` Alan Stern
2012-07-03 17:32 ` Matthew Wilcox
2012-07-03 19:50 ` Alan Stern
2012-07-03 20:07 ` James Bottomley
2012-07-03 20:25 ` Alan Stern
2012-07-03 20:35 ` Matthew Wilcox
2012-07-05 21:40 ` Alan Stern
2012-07-06 3:05 ` Matthew Wilcox
2012-07-06 14:00 ` Alan Stern
2012-07-04 4:39 ` Ben Hutchings
2012-07-01 17:20 ` [ 39/48] PM / Sleep: Prevent waiting forever on asynchronous suspend after abort Ben Hutchings
2012-07-01 17:20 ` [ 40/48] x86, cpufeature: Rename X86_FEATURE_DTS to X86_FEATURE_DTHERM Ben Hutchings
2012-07-01 17:20 ` [ 42/48] ALSA: hda - Add Realtek ALC280 codec support Ben Hutchings
2012-07-01 17:20 ` [ 43/48] USB: option: Add USB ID for Novatel Ovation MC551 Ben Hutchings
2012-07-01 17:20 ` [ 45/48] xen/netfront: teardown the device before unregistering it Ben Hutchings
2012-07-01 17:20 ` [ 46/48] can: flexcan: use be32_to_cpup to handle the value of dt entry Ben Hutchings
2012-07-01 17:20 ` [ 47/48] acpi_pad: fix power_saving thread deadlock Ben Hutchings
2012-07-01 17:20 ` [ 48/48] batman-adv: only drop packets of known wifi clients Ben Hutchings
2012-07-01 19:11 ` [ 00/48] 3.2.22-stable review Ben Hutchings
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=4FF14957.3040007@redhat.com \
--to=hdegoede@redhat.com \
--cc=JBottomley@parallels.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=ben@decadent.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mdharm-usb@one-eyed-alien.net \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).