Re: [PATCH] COMPARE_AND_WRITE: If the compare fails we should not continue to write the data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(Resending withouth HTML)

Tomo,

Note that the command is not yet activated again, since there is also
at least one more bug in how the sense code is generated IF the
compare fails.
For that case the sense code INFORMATION field should contain the byte
offset into the databuffer where the first mismatch occured.
I will modify the currently private function in SSC that already
provides such an API to set the INFORMATION field in a future patch to
make this function public and available to COMPARE-AND-WRITE.

This particular patch here fixes the code so that we comply with : (from SBC)

1) perform the following operations:
  A) read the specified logical blocks; and
  B) transfer the specified number of logical blocks from the Data-Out
Buffer (i.e., the verify instance of
    the data is transferred from the Data-Out Buffer);
2) compare the data read from the specified logical blocks with the
verify instance of the data; and
3) If the compared data matches, then perform the following operations:
  1) transfer the specified number of logical blocks from the Data-Out
Buffer (i.e., the write instance of
the data transferred from the Data-Out Buffer); and
  2) write those logical blocks.


Before we would unconditionally always write the buffer to the disk,
even if it did not match, which is wrong.
The text above from SBC describes that we will only perform steps 3.1
and 3.2 IFF the data did match.


So I think this patch is safe to apply. It does address a genuine bug
in the implementation.
However, the opcode is still deactivated and should remain deactivated
until it can be confirmed that all bugs in the CAW opcode are fixed.



regards
ronnie sahlberg



On Thu, Aug 30, 2012 at 4:56 PM, FUJITA Tomonori
<fujita.tomonori@xxxxxxxxxxxxx> wrote:
>
> On Thu, 30 Aug 2012 09:09:39 -0700
> Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx> wrote:
>
> > Fix a bug in COMPARE-AND-WRITE. If the compare fails, we have to abort with a sense code immediately and we should NOT continue to over-write the backing store with the mismatching data.
> >
> > IF the data is not matching, we also should compute at which offset the first mismatch in the buffer occurs.
> > This is to be reported in the INFORMATION field (bytes 3-7) in the sense buffer in a later patch.
> >
> > Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>
> > ---
> >  usr/bs_rdwr.c |   25 +++++++++++++++++++++++--
> >  1 files changed, 23 insertions(+), 2 deletions(-)
>
> I'm not sure this fixes the previous issue. I'm happy to apply it if
> someone confirms it.
>
> Thanks,
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux