mbox series

[v2,0/5] scsi: target: COMPARE AND WRITE miscompare sense

Message ID 20201026190646.8727-1-ddiss@suse.de
Headers show
Series scsi: target: COMPARE AND WRITE miscompare sense | expand

Message

David Disseldorp Oct. 26, 2020, 7:06 p.m. UTC
This patchset adds missing functionality to return the offset of
non-matching read/compare data in the sense INFORMATION field on
COMPARE AND WRITE miscompare.

The functionality can be tested using the libiscsi
CompareAndWrite.MiscompareSense test proposed via:
  https://github.com/sahlberg/libiscsi/pull/344

Changes since v1:
- drop unnecessary WARN_ON()
- fix two checkpatch warnings
- drop single-use nlbas variable
- avoid compare_len recalculation

Cheers, David

 drivers/target/target_core_sbc.c       | 137 +++++++++++++++----------
 drivers/target/target_core_transport.c |  33 +++---
 include/target/target_core_base.h      |   2 +-
 lib/scatterlist.c                      |   2 +-
 4 files changed, 102 insertions(+), 72 deletions(-)

Comments

Douglas Gilbert Oct. 26, 2020, 8:50 p.m. UTC | #1
On 2020-10-26 3:06 p.m., David Disseldorp wrote:
> sg_copy_buffer() returns a size_t with the number of bytes copied.

> Return 0 instead of false if the copy is skipped.

> 

> Signed-off-by: David Disseldorp <ddiss@suse.de>

> ---

>   lib/scatterlist.c | 2 +-

>   1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/lib/scatterlist.c b/lib/scatterlist.c

> index 0a482ef988e5..a59778946404 100644

> --- a/lib/scatterlist.c

> +++ b/lib/scatterlist.c

> @@ -933,7 +933,7 @@ size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf,

>   	sg_miter_start(&miter, sgl, nents, sg_flags);

>   

>   	if (!sg_miter_skip(&miter, skip))

> -		return false;

> +		return 0;

>   

>   	while ((offset < buflen) && sg_miter_next(&miter)) {

>   		unsigned int len;

> 


This one probably should be sent by itself as a fix to:
    linux-block@vger.kernel.org

and cc-ed to:
    axboe@kernel.dk

on the assumption that Jens Axboe is the maintainer of lib/scatterlist.c .
He put a fix of mine in sgl_alloc_order() into the kernel recently.

Otherwise:
Reviewed-by: Douglas Gilbert <dgilbert@interlog.com>
David Disseldorp Oct. 26, 2020, 9:05 p.m. UTC | #2
On Mon, 26 Oct 2020 16:50:53 -0400, Douglas Gilbert wrote:

> On 2020-10-26 3:06 p.m., David Disseldorp wrote:

> > sg_copy_buffer() returns a size_t with the number of bytes copied.

> > Return 0 instead of false if the copy is skipped.

> > 

> > Signed-off-by: David Disseldorp <ddiss@suse.de>

> > ---

> >   lib/scatterlist.c | 2 +-

> >   1 file changed, 1 insertion(+), 1 deletion(-)

> > 

> > diff --git a/lib/scatterlist.c b/lib/scatterlist.c

> > index 0a482ef988e5..a59778946404 100644

> > --- a/lib/scatterlist.c

> > +++ b/lib/scatterlist.c

> > @@ -933,7 +933,7 @@ size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf,

> >   	sg_miter_start(&miter, sgl, nents, sg_flags);

> >   

> >   	if (!sg_miter_skip(&miter, skip))

> > -		return false;

> > +		return 0;

> >   

> >   	while ((offset < buflen) && sg_miter_next(&miter)) {

> >   		unsigned int len;

> >   

> 

> This one probably should be sent by itself as a fix to:

>     linux-block@vger.kernel.org

> 

> and cc-ed to:

>     axboe@kernel.dk

> 

> on the assumption that Jens Axboe is the maintainer of lib/scatterlist.c .

> He put a fix of mine in sgl_alloc_order() into the kernel recently.

> 

> Otherwise:

> Reviewed-by: Douglas Gilbert <dgilbert@interlog.com>


Sent. Thanks Douglas!
Mike Christie Oct. 27, 2020, 5:49 a.m. UTC | #3
On 10/26/20 2:06 PM, David Disseldorp wrote:
> This patchset adds missing functionality to return the offset of
> non-matching read/compare data in the sense INFORMATION field on
> COMPARE AND WRITE miscompare.
> 
> The functionality can be tested using the libiscsi
> CompareAndWrite.MiscompareSense test proposed via:
>    https://urldefense.com/v3/__https://github.com/sahlberg/libiscsi/pull/344__;!!GqivPVa7Brio!LJ-un7MDdHXhZgIK1qgvDgza2El16FK-T_4oDi6VqM0CzetAV9pGHDvLDrZUkITTHxhO$
> 
> Changes since v1:
> - drop unnecessary WARN_ON()
> - fix two checkpatch warnings
> - drop single-use nlbas variable
> - avoid compare_len recalculation
> 
> Cheers, David
> 
>   drivers/target/target_core_sbc.c       | 137 +++++++++++++++----------
>   drivers/target/target_core_transport.c |  33 +++---
>   include/target/target_core_base.h      |   2 +-
>   lib/scatterlist.c                      |   2 +-
>   4 files changed, 102 insertions(+), 72 deletions(-)


Reviewed-by: Mike Christie <michael.christie@oracle.com>
David Disseldorp Oct. 27, 2020, 9:57 a.m. UTC | #4
On Tue, 27 Oct 2020 00:49:23 -0500, Mike Christie wrote:

> On 10/26/20 2:06 PM, David Disseldorp wrote:

> > This patchset adds missing functionality to return the offset of

> > non-matching read/compare data in the sense INFORMATION field on

> > COMPARE AND WRITE miscompare.

...
> > Changes since v1:

> > - drop unnecessary WARN_ON()

> > - fix two checkpatch warnings

> > - drop single-use nlbas variable

> > - avoid compare_len recalculation

> > 

> > Cheers, David

> > 

> >   drivers/target/target_core_sbc.c       | 137 +++++++++++++++----------

> >   drivers/target/target_core_transport.c |  33 +++---

> >   include/target/target_core_base.h      |   2 +-

> >   lib/scatterlist.c                      |   2 +-

> >   4 files changed, 102 insertions(+), 72 deletions(-)  

> 

> 

> Reviewed-by: Mike Christie <michael.christie@oracle.com>


Thanks Mike.
@Martin: please pull patches 2/5 through to 5/5 only; the independent
scatterlist patch 1/5 has been submitted via linux-block.

Cheers, David
Martin K. Petersen Oct. 30, 2020, 2:02 a.m. UTC | #5
David,

> This patchset adds missing functionality to return the offset of

> non-matching read/compare data in the sense INFORMATION field on

> COMPARE AND WRITE miscompare.


Applied 2-5 to 5.11/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering
Martin K. Petersen Oct. 30, 2020, 2:06 a.m. UTC | #6
>> This patchset adds missing functionality to return the offset of
>> non-matching read/compare data in the sense INFORMATION field on
>> COMPARE AND WRITE miscompare.
>
> Applied 2-5 to 5.11/scsi-staging, thanks!

Dropped again, breaks IB.
David Disseldorp Oct. 30, 2020, 2:06 p.m. UTC | #7
On Thu, 29 Oct 2020 22:06:00 -0400, Martin K. Petersen wrote:

> >> This patchset adds missing functionality to return the offset of

> >> non-matching read/compare data in the sense INFORMATION field on

> >> COMPARE AND WRITE miscompare.  

> >

> > Applied 2-5 to 5.11/scsi-staging, thanks!  

> 

> Dropped again, breaks IB.

> 


Hmm, I overlooked ib_isert in the bad_sector->sense_info rename, sorry.
I'll post a v3 when done with testing.

Cheers, David