linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Regression][Stable] sd use scsi_mode_sense with invalid param
@ 2021-11-26 21:11 Tom Yan
  2021-11-26 21:21 ` Tom Yan
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Yan @ 2021-11-26 21:11 UTC (permalink / raw)
  To: linux-scsi, damien.lemoal, martin.petersen, sashal

Hi,

So with 17b49bcbf8351d3dbe57204468ac34f033ed60bc (upstream),
scsi_mode_sense now returns -EINVAL if len < 8, yet in sd, the first mode
sense attempted by sd_read_cache_type() is done with (first_)len being
4, which results in the failure of the attempt.

Since the commit is merged into stable, my SATA drive (that has
volatile write cache) is assumed to be a "write through" drive after I
upgraded from 5.15.4 to 5.15.5, as libata sets use_10_for_ms to 1.

Since sd does not (get to) determine which mode sense command to use,
should scsi_mode_sense at least accept a special value 0 (which
first_len would be set to), which is use to refers to the minimum len
to use for mode sense 6 and 10 respectively (i.e. 4 or 8)?

Regards,
Tom

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

* Re: [Regression][Stable] sd use scsi_mode_sense with invalid param
  2021-11-26 21:11 [Regression][Stable] sd use scsi_mode_sense with invalid param Tom Yan
@ 2021-11-26 21:21 ` Tom Yan
  2021-11-26 21:33   ` Tom Yan
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Yan @ 2021-11-26 21:21 UTC (permalink / raw)
  To: linux-scsi, damien.lemoal, martin.petersen, sashal

Ahh, looks like the required change to sd
(c749301ebee82eb5e97dec14b6ab31a4aabe37a6) has been added to upstream
but somehow got missed when 17b49bcbf8351d3dbe57204468ac34f033ed60bc
was pulled into stable...

On Sat, 27 Nov 2021 at 05:11, Tom Yan <tom.ty89@gmail.com> wrote:
>
> Hi,
>
> So with 17b49bcbf8351d3dbe57204468ac34f033ed60bc (upstream),
> scsi_mode_sense now returns -EINVAL if len < 8, yet in sd, the first mode
> sense attempted by sd_read_cache_type() is done with (first_)len being
> 4, which results in the failure of the attempt.
>
> Since the commit is merged into stable, my SATA drive (that has
> volatile write cache) is assumed to be a "write through" drive after I
> upgraded from 5.15.4 to 5.15.5, as libata sets use_10_for_ms to 1.
>
> Since sd does not (get to) determine which mode sense command to use,
> should scsi_mode_sense at least accept a special value 0 (which
> first_len would be set to), which is use to refers to the minimum len
> to use for mode sense 6 and 10 respectively (i.e. 4 or 8)?
>
> Regards,
> Tom

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

* Re: [Regression][Stable] sd use scsi_mode_sense with invalid param
  2021-11-26 21:21 ` Tom Yan
@ 2021-11-26 21:33   ` Tom Yan
  2021-11-27  1:15     ` Damien Le Moal
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Yan @ 2021-11-26 21:33 UTC (permalink / raw)
  To: linux-scsi, damien.lemoal, martin.petersen, sashal, stable, Greg KH

Hi Greg,

Could you help pulling c749301ebee82eb5e97dec14b6ab31a4aabe37a6 into
the stable branches in which 17b49bcbf8351d3dbe57204468ac34f033ed60bc
has been pulled? Thanks!

Regards,
Tom

On Sat, 27 Nov 2021 at 05:21, Tom Yan <tom.ty89@gmail.com> wrote:
>
> Ahh, looks like the required change to sd
> (c749301ebee82eb5e97dec14b6ab31a4aabe37a6) has been added to upstream
> but somehow got missed when 17b49bcbf8351d3dbe57204468ac34f033ed60bc
> was pulled into stable...
>
> On Sat, 27 Nov 2021 at 05:11, Tom Yan <tom.ty89@gmail.com> wrote:
> >
> > Hi,
> >
> > So with 17b49bcbf8351d3dbe57204468ac34f033ed60bc (upstream),
> > scsi_mode_sense now returns -EINVAL if len < 8, yet in sd, the first mode
> > sense attempted by sd_read_cache_type() is done with (first_)len being
> > 4, which results in the failure of the attempt.
> >
> > Since the commit is merged into stable, my SATA drive (that has
> > volatile write cache) is assumed to be a "write through" drive after I
> > upgraded from 5.15.4 to 5.15.5, as libata sets use_10_for_ms to 1.
> >
> > Since sd does not (get to) determine which mode sense command to use,
> > should scsi_mode_sense at least accept a special value 0 (which
> > first_len would be set to), which is use to refers to the minimum len
> > to use for mode sense 6 and 10 respectively (i.e. 4 or 8)?
> >
> > Regards,
> > Tom

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

* Re: [Regression][Stable] sd use scsi_mode_sense with invalid param
  2021-11-26 21:33   ` Tom Yan
@ 2021-11-27  1:15     ` Damien Le Moal
  2021-11-27 11:55       ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Damien Le Moal @ 2021-11-27  1:15 UTC (permalink / raw)
  To: Tom Yan, linux-scsi, damien.lemoal, martin.petersen, sashal,
	stable, Greg KH

On 2021/11/27 6:33, Tom Yan wrote:
> Hi Greg,
> 
> Could you help pulling c749301ebee82eb5e97dec14b6ab31a4aabe37a6 into
> the stable branches in which 17b49bcbf8351d3dbe57204468ac34f033ed60bc
> has been pulled? Thanks!

Yeah, in retrospect, these 2 patches should really have been squashed together.
Sorry about that. Note that none of these were marked for stable though. I think
that Sasha's bot picked-up automatically
17b49bcbf8351d3dbe57204468ac34f033ed60bc for stable because of the "Fix" in the
commit title. But c749301ebee82eb5e97dec14b6ab31a4aabe37a6 also has "Fix" in its
title but was not picked-up. Weird.

Greg, Martin,

To fix this, c749301ebee82eb5e97dec14b6ab31a4aabe37a6 is needed in stable !

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=215137

Thanks.

> 
> Regards,
> Tom
> 
> On Sat, 27 Nov 2021 at 05:21, Tom Yan <tom.ty89@gmail.com> wrote:
>>
>> Ahh, looks like the required change to sd
>> (c749301ebee82eb5e97dec14b6ab31a4aabe37a6) has been added to upstream
>> but somehow got missed when 17b49bcbf8351d3dbe57204468ac34f033ed60bc
>> was pulled into stable...
>>
>> On Sat, 27 Nov 2021 at 05:11, Tom Yan <tom.ty89@gmail.com> wrote:
>>>
>>> Hi,
>>>
>>> So with 17b49bcbf8351d3dbe57204468ac34f033ed60bc (upstream),
>>> scsi_mode_sense now returns -EINVAL if len < 8, yet in sd, the first mode
>>> sense attempted by sd_read_cache_type() is done with (first_)len being
>>> 4, which results in the failure of the attempt.
>>>
>>> Since the commit is merged into stable, my SATA drive (that has
>>> volatile write cache) is assumed to be a "write through" drive after I
>>> upgraded from 5.15.4 to 5.15.5, as libata sets use_10_for_ms to 1.
>>>
>>> Since sd does not (get to) determine which mode sense command to use,
>>> should scsi_mode_sense at least accept a special value 0 (which
>>> first_len would be set to), which is use to refers to the minimum len
>>> to use for mode sense 6 and 10 respectively (i.e. 4 or 8)?
>>>
>>> Regards,
>>> Tom


-- 
Damien Le Moal
Western Digital Research

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

* Re: [Regression][Stable] sd use scsi_mode_sense with invalid param
  2021-11-27  1:15     ` Damien Le Moal
@ 2021-11-27 11:55       ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2021-11-27 11:55 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: Tom Yan, linux-scsi, damien.lemoal, martin.petersen, sashal, stable

On Sat, Nov 27, 2021 at 10:15:51AM +0900, Damien Le Moal wrote:
> On 2021/11/27 6:33, Tom Yan wrote:
> > Hi Greg,
> > 
> > Could you help pulling c749301ebee82eb5e97dec14b6ab31a4aabe37a6 into
> > the stable branches in which 17b49bcbf8351d3dbe57204468ac34f033ed60bc
> > has been pulled? Thanks!
> 
> Yeah, in retrospect, these 2 patches should really have been squashed together.
> Sorry about that. Note that none of these were marked for stable though. I think
> that Sasha's bot picked-up automatically
> 17b49bcbf8351d3dbe57204468ac34f033ed60bc for stable because of the "Fix" in the
> commit title. But c749301ebee82eb5e97dec14b6ab31a4aabe37a6 also has "Fix" in its
> title but was not picked-up. Weird.
> 
> Greg, Martin,
> 
> To fix this, c749301ebee82eb5e97dec14b6ab31a4aabe37a6 is needed in stable !
> 
> Reference: https://bugzilla.kernel.org/show_bug.cgi?id=215137

Now queued up, thanks.

greg k-h

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

end of thread, other threads:[~2021-11-27 12:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-26 21:11 [Regression][Stable] sd use scsi_mode_sense with invalid param Tom Yan
2021-11-26 21:21 ` Tom Yan
2021-11-26 21:33   ` Tom Yan
2021-11-27  1:15     ` Damien Le Moal
2021-11-27 11:55       ` Greg KH

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