All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Douglas Gilbert <dgilbert@interlog.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH v2] scsi: core: Make MODE SENSE DBD a boolean
Date: Thu, 26 Mar 2020 20:51:55 -0400	[thread overview]
Message-ID: <yq1y2rmfwlw.fsf@oracle.com> (raw)
In-Reply-To: <257ddb5a-87f3-9e27-8f9a-d647483528ab@interlog.com> (Douglas Gilbert's message of "Wed, 25 Mar 2020 21:44:00 -0400")


Doug,

> I think scsi_mode_sense() needs looking at. It says this in its header:
>
> *      @dbd:   set if mode sense will allow block descriptors to be returned

Yeah, that's also broken.

> which is a worry when you consider that DBD bit means "DISABLE block
> descriptors" [spc6r01.pdf chapter 6.14.1]. If the caller wants block
> descriptors (i.e. dbd=0 (or false)) then they really should set the
> LLBA bit or they will be truncating any LBAs (in the returned block
> descriptors) greater than 2**32-1 to the lower 32 bits. However only
> the MODE SENSE(10) command has the LLBA bit. So if MODE SENSE(10)
> fails and you leave the LLBA bit set and switch to MODE SENSE(6) then
> the device server is within its rights to say: WTF is bit 4 in
> byte 1 set? Hence ==> illegal request.

I agree. I simply zapped it because none of the callers of
scsi_mode_sense() actually set LLBAA, nor did any of them care about the
block descriptors.

I think it's mostly a historical artifact that some callers request the
descriptors. But the concern is obviously what blows up if we suddenly
start setting DBD flag while querying the Caching Mode Page on the usual
suspects in the USB department.

> That function is just badly designed and does not allow for subpages.
> Can it be thrown out?

Given the very limited use inside the kernel it didn't seem worth the
hassle/risk to make it a full fledged MODE SENSE implementation. But I
am happy to entertain cleanups in this department. I was really just
trying to silence a warning.

-- 
Martin K. Petersen	Oracle Linux Engineering

      reply	other threads:[~2020-03-27  0:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-25 21:36 [PATCH] scsi: core: Make MODE SENSE DBD a boolean Martin K. Petersen
2020-03-25 21:45 ` Bart Van Assche
2020-03-25 22:06   ` Martin K. Petersen
2020-03-25 22:24   ` [PATCH v2] " Martin K. Petersen
2020-03-26  1:44     ` Douglas Gilbert
2020-03-27  0:51       ` Martin K. Petersen [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=yq1y2rmfwlw.fsf@oracle.com \
    --to=martin.petersen@oracle.com \
    --cc=dgilbert@interlog.com \
    --cc=linux-scsi@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.