linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Matthew Dharm <mdharm-scsi@one-eyed-alien.net>,
	James Bottomley <James.Bottomley@suse.de>,
	Tejun Heo <tj@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	SCSI development list <linux-scsi@vger.kernel.org>,
	USB list <linux-usb@vger.kernel.org>
Subject: Re: [PATCH resend 1/4] scsi/sr: add no_read_disc_info scsi_device flag
Date: Wed, 04 Aug 2010 17:32:41 +0200	[thread overview]
Message-ID: <4C598819.3000205@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1008041119370.1998-100000@iolanthe.rowland.org>

Hi,

On 08/04/2010 05:25 PM, Alan Stern wrote:
> On Wed, 4 Aug 2010, Hans de Goede wrote:
>
>> Hi,
>>
>> On 08/04/2010 04:41 PM, Alan Stern wrote:
>>> On Tue, 3 Aug 2010, Matthew Dharm wrote:
>>>
>>>> I'm willing to bet there are more devices out there like this.  Experience
>>>> has shown that the more we make the stack issue commands to the device like
>>>> one of the "popular" OSes, the fewer problems we have.  Thus, I prefer to
>>>> fix these where commands originate.
>>>
>>> This is a good point.  Since Windows apparently never sends
>>> READ_DISC_INFO commands, we court trouble by using those commands in
>>> the cdrom driver.  Is there any way to avoid using them?
>>>
>>> As far as the READ-CAPACITY(16) bug, there may be a simpler fix.  In
>>> sd_read_capacity(), change
>>>
>>> 	if (sdp->fix_capacity ||
>>>
>>> to
>>>
>>> 	if ((sdp->fix_capacity&&   sdkp->capacity>   0) ||
>>
>> That won't work, the trouble happens before fix_capacity comes into play. The
>> overflow is happening inside the mp3 player. When there is no card in the slot
>> the mp3 player tries to report a size of 0. But as scsi get_capacity uses
>> the last sector number, the mp3 player returns its internal size variable -1,
>> resulting in it returning 0xffffffff. This then gets increased by 1 by
>> read_capacity_10 to 0x100000000, which triggers the following bit:
>>
>>                   if ((sizeof(sdkp->capacity)>  4)&&
>>                       (sdkp->capacity>  0xffffffffULL)) {
>>                           int old_sector_size = sector_size;
>>                           sd_printk(KERN_NOTICE, sdkp, "Very big device. "
>>                                           "Trying to use READ CAPACITY(16).\n");
>>                           sector_size = read_capacity_16(sdkp, sdp, buffer);
>>
>> This issues a READ CAPACITY(16) and the mp3 player dies (until reset). Also
>> notice that my sd.c patch for this does more then just stop sd.c from
>> sending READ CAPACITY(16), it also turns a READ CAPACITY(10) answer
>> of 0xffffffff into 0 instead of 0x100000000 when the quirk flag is set.
>
> Okay, so much for that bright idea.
>
> On the other hand, it's clear that the sd driver doesn't even try to
> issue a READ CAPACITY command if there's no medium present.  How come
> this is happening at all?  Does the device report that a card is
> present even when the slot is empty?  Or does it claim not to have
> removable media in the first place?
>

I have not investigated, but this is not something which we can easily fix
with a quirk AFAIK, as some of the LUN's of the device are not removable
and others are, and we don't know if there is a card present or not.

More over I guess (but have not verified) the answer is:
It claims not to have removable media in the first place

Regards,

Hans

  reply	other threads:[~2010-08-04 15:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23  8:52 [PATCH resend 1/4] scsi/sr: add no_read_disc_info scsi_device flag Hans de Goede
     [not found] ` <1279875174-2905-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-23  8:52   ` [PATCH resend 2/4] usb-storage: Add new no_read_disc_info quirk Hans de Goede
2010-07-28 13:19   ` [PATCH resend 1/4] scsi/sr: add no_read_disc_info scsi_device flag James Bottomley
2010-08-02 21:43     ` Hans de Goede
2010-08-03 14:14       ` Alan Stern
     [not found]         ` <Pine.LNX.4.44L0.1008031012160.1853-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2010-08-03 16:37           ` Matthew Dharm
2010-08-03 16:48             ` James Bottomley
2010-08-03 22:42               ` Matthew Dharm
     [not found]                 ` <20100803224207.GA8682-JGfshJpz5UybPZpvUQj5UqxOck334EZe@public.gmane.org>
2010-08-04 14:41                   ` Alan Stern
2010-08-04 14:54                     ` Hans de Goede
     [not found]                       ` <4C597F0C.4070304-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-08-04 15:25                         ` Alan Stern
2010-08-04 15:32                           ` Hans de Goede [this message]
2010-07-23  8:52 ` [PATCH resend 3/4] scsi/sd: Add a no_read_capacity_16 " Hans de Goede
2010-07-23  8:52 ` [PATCH resend 4/4] usb-storage: Add new no_read_capacity_16 quirk Hans de Goede
  -- strict thread matches above, loose matches on Subject: below --
2010-07-22 15:11 [PATCH resend 1/4] scsi/sr: add no_read_disc_info scsi_device flag Hans de Goede

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=4C598819.3000205@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=James.Bottomley@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mdharm-scsi@one-eyed-alien.net \
    --cc=stern@rowland.harvard.edu \
    --cc=tj@kernel.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).