[stgt] [PATCH] Patch for COMPARE-AND-WRITE

Ronnie Sahlberg ronniesahlberg at gmail.com
Thu Aug 30 18:09:38 CEST 2012

Tomo, List

Please find a first patch for COMPARE-AND-WRITE.
Compare-and-write is still disabled as per your previous patch, but this fixes one
of two bugs in the disabled compare-and-write code.

IF the data does not match, we have to abort the compare and write immediately with a sense code. In particular we should NOT continue and write the mismatching data to the backing store. (this is likely what caused corurption and esx problems)

Secondly, If the data does not match, we perform an expensive byte by byte compare of the buffers to find at which offset the first mismatch occured.
We currently dont use this value but should later return this in the INFORMATION field (bytes 3-7) of the sense buffer.

We already have a private function in bs_ssc.c that builds a sense buffer containing an INFORMATION field : ssc_sense_data_build() but that function is private to SSC.
A later patch will rename ssc_sense_data_build() to sense_data_build_with_info() and make it public.
That will then allow us to use this fucntion from COMPARE-AND-WRITE (and probably also from VERIFY*) and set the INFORMATION field in the sense buffer correctly.

Once we have fixed this bug addressed in this patch, and later also fixed the handling/reporting in INFORMATION, then we can re-test with ESX and see if it is possible to re-enable the COMPARE-AND-WRITE fucntion again.

ronnie sahlberg

To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

More information about the stgt mailing list