From: Bart Van Assche <Bart.VanAssche@sandisk.com>
To: "nab@linux-iscsi.org" <nab@linux-iscsi.org>
Cc: "hch@lst.de" <hch@lst.de>, "ddiss@suse.de" <ddiss@suse.de>,
"hare@suse.com" <hare@suse.com>,
"target-devel@vger.kernel.org" <target-devel@vger.kernel.org>,
"agrover@redhat.com" <agrover@redhat.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH 06/19] target: Fix data buffer size for VERIFY and WRITE AND VERIFY commands
Date: Mon, 8 May 2017 18:07:43 +0000 [thread overview]
Message-ID: <1494266862.2591.14.camel@sandisk.com> (raw)
In-Reply-To: <1494197384.30469.34.camel@haakon3.risingtidesystems.com>
On Sun, 2017-05-07 at 15:49 -0700, Nicholas A. Bellinger wrote:
> On Thu, 2017-05-04 at 15:50 -0700, Bart Van Assche wrote:
> > For VERIFY and WRITE AND VERIFY commands the size of the SCSI
> > Data-Out buffer can differ from the size of the data area on
> > the storage medium that is affected by the command. Make sure
> > that the Data-Out buffer size is computed correctly. Apparently
> > this part got dropped from my previous VERIFY / WRITE AND VERIFY
> > patch before I posted it due to rebasing.
> >
> > Fixes: commit 0e2eb7d12eaa ("target: Fix VERIFY and WRITE VERIFY command parsing")
> > Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> > Cc: Hannes Reinecke <hare@suse.com>
> > Cc: Christoph Hellwig <hch@lst.de>
> > Cc: Andy Grover <agrover@redhat.com>
> > Cc: David Disseldorp <ddiss@suse.de>
> > Cc: <stable@vger.kernel.org>
> > ---
> > drivers/target/target_core_sbc.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
> > index a0ad618f1b1a..51489d96cb31 100644
> > --- a/drivers/target/target_core_sbc.c
> > +++ b/drivers/target/target_core_sbc.c
> > @@ -888,9 +888,10 @@ static sense_reason_t sbc_parse_verify(struct se_cmd *cmd, int *sectors,
> > sense_reason_t
> > sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
> > {
> > + enum { INVALID_SIZE = 1 };
> > struct se_device *dev = cmd->se_dev;
> > unsigned char *cdb = cmd->t_task_cdb;
> > - unsigned int size;
> > + unsigned int size = INVALID_SIZE;
> > u32 sectors = 0;
> > sense_reason_t ret;
> >
> > @@ -1212,7 +1213,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
> > return TCM_ADDRESS_OUT_OF_RANGE;
> > }
> >
> > - if (!(cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE))
> > + if (size == INVALID_SIZE)
> > size = sbc_get_size(cmd, sectors);
> > }
> >
>
> This patch has no effect.
Hello Nic,
That's a misinterpretation of your side. What this patch does is to ensure
that 'size' remains zero if a VERIFY or WRITE AND VERIFY command is submitted
with BYTCHK == 0. SBC mentions clearly that BYTCHK == 0 means that there is
no Data-Out buffer, or in other words, that the size of the Data-Out buffer
is zero.
>From the sg_verify man page:
When --ndo=NDO is not given then the verify starts at the logical block
address given by the --lba=LBA option and continues for --count=COUNT
blocks.
In other words, sg_verify is able to submit a VERIFY command without Data-Out
buffer (NDO is the size of the Data-Out buffer in bytes).
> Anyways, I've fixed both cases and will post the proper fix inline
> against patch #19.
Do you perhaps mean patch "target: Fix sbc_parse_verify bytchk = 0 handling"?
(https://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git/commit/?h=for-next&id=d7d40280f868463d01a82186fd61cdc0e590381f)
If you want to know my opinion about that patch: it doesn't fix anything but
breaks the sbc_parse_verify() function and definitely doesn't make the
behavior of VERIFY nor WRITE AND VERIFY more compliant with the SCSI specs.
Bart.
next prev parent reply other threads:[~2017-05-08 18:07 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170504225102.8931-1-bart.vanassche@sandisk.com>
2017-05-04 22:50 ` [PATCH 03/19] target: Avoid that aborting a command sporadically hangs Bart Van Assche
2017-05-05 6:12 ` Hannes Reinecke
2017-05-05 8:53 ` Christoph Hellwig
2017-05-05 15:00 ` Bart Van Assche
2017-05-11 0:23 ` Bart Van Assche
2017-05-07 22:20 ` Nicholas A. Bellinger
2017-05-08 21:25 ` Bart Van Assche
2017-05-10 4:48 ` Nicholas A. Bellinger
2017-05-04 22:50 ` [PATCH 04/19] target/fileio: Avoid that zero-length READ and WRITE commands hang Bart Van Assche
2017-05-05 6:14 ` Hannes Reinecke
2017-05-05 8:54 ` Christoph Hellwig
2017-05-07 22:28 ` Nicholas A. Bellinger
2017-05-04 22:50 ` [PATCH 05/19] target: Allocate sg-list correctly Bart Van Assche
2017-05-05 6:15 ` Hannes Reinecke
2017-05-05 9:06 ` Christoph Hellwig
2017-05-05 15:49 ` Bart Van Assche
2017-05-07 22:45 ` Nicholas A. Bellinger
2017-05-08 17:46 ` Bart Van Assche
2017-05-10 4:03 ` Nicholas A. Bellinger
2017-05-10 6:12 ` Nicholas A. Bellinger
2017-05-10 20:31 ` Bart Van Assche
2017-05-11 5:28 ` Nicholas A. Bellinger
2017-05-04 22:50 ` [PATCH 06/19] target: Fix data buffer size for VERIFY and WRITE AND VERIFY commands Bart Van Assche
2017-05-05 9:42 ` Christoph Hellwig
2017-05-05 15:51 ` Bart Van Assche
2017-05-07 22:49 ` Nicholas A. Bellinger
2017-05-08 18:07 ` Bart Van Assche [this message]
2017-05-10 4:28 ` Nicholas A. Bellinger
2017-05-10 15:16 ` Bart Van Assche
2017-05-11 5:09 ` Nicholas A. Bellinger
2017-05-04 22:51 ` [PATCH 17/19] target/iscsi: Simplify timer manipulation code Bart Van Assche
2017-05-05 11:24 ` Hannes Reinecke
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=1494266862.2591.14.camel@sandisk.com \
--to=bart.vanassche@sandisk.com \
--cc=agrover@redhat.com \
--cc=ddiss@suse.de \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=nab@linux-iscsi.org \
--cc=stable@vger.kernel.org \
--cc=target-devel@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.