mbox series

[v2,0/7] Fix handling of bidi commands

Message ID 20190123191013.119684-1-bvanassche@acm.org (mailing list archive)
Headers show
Series Fix handling of bidi commands | expand

Message

Bart Van Assche Jan. 23, 2019, 7:10 p.m. UTC
Hi Martin,

Recently Doug Gilbert reported that handling of bidi commands is broken
in the scsi-mq code. This patch series fixes that bug and also simplifies
bidi command handling. Please consider these patches for kernel v5.1.

Thanks,

Bart.

Changes compared to v1:
- Fixed a NULL pointer dereference in scsi_init_sdb().

Bart Van Assche (7):
  Introduce the bidi_supported flag in the host template structure
  Change scsi_cmnd.prot_sdb from a pointer into a regular member
  Fix bidi handling
  Introduce scsi_out_cmd()
  Move several function definitions in <scsi/scsi_cmnd.h>
  Introduce scsi_in_[sg]et_resid() and scsi_out_[sg]et_resid()
  Move the resid member from struct scsi_data_buffer into struct
    scsi_cmnd

 drivers/scsi/iscsi_tcp.c           |  8 +---
 drivers/scsi/libiscsi.c            | 12 ++---
 drivers/scsi/scsi_debug.c          | 20 +++------
 drivers/scsi/scsi_lib.c            | 70 ++++++++++++------------------
 drivers/scsi/sd.c                  |  4 +-
 drivers/scsi/virtio_scsi.c         |  4 +-
 drivers/target/loopback/tcm_loop.c |  8 +---
 drivers/usb/storage/uas.c          |  8 ++--
 include/scsi/scsi_cmnd.h           | 67 ++++++++++++++++++++--------
 include/scsi/scsi_host.h           |  2 +
 10 files changed, 101 insertions(+), 102 deletions(-)

Comments

Douglas Gilbert Jan. 24, 2019, 1:29 a.m. UTC | #1
On 2019-01-23 2:10 p.m., Bart Van Assche wrote:
> Hi Martin,
> 
> Recently Doug Gilbert reported that handling of bidi commands is broken
> in the scsi-mq code. This patch series fixes that bug and also simplifies
> bidi command handling. Please consider these patches for kernel v5.1.
> 
> Thanks,
> 
> Bart.
> 
> Changes compared to v1:
> - Fixed a NULL pointer dereference in scsi_init_sdb().
> 
> Bart Van Assche (7):
>    Introduce the bidi_supported flag in the host template structure
>    Change scsi_cmnd.prot_sdb from a pointer into a regular member
>    Fix bidi handling
>    Introduce scsi_out_cmd()
>    Move several function definitions in <scsi/scsi_cmnd.h>
>    Introduce scsi_in_[sg]et_resid() and scsi_out_[sg]et_resid()
>    Move the resid member from struct scsi_data_buffer into struct
>      scsi_cmnd
> 
>   drivers/scsi/iscsi_tcp.c           |  8 +---
>   drivers/scsi/libiscsi.c            | 12 ++---
>   drivers/scsi/scsi_debug.c          | 20 +++------
>   drivers/scsi/scsi_lib.c            | 70 ++++++++++++------------------
>   drivers/scsi/sd.c                  |  4 +-
>   drivers/scsi/virtio_scsi.c         |  4 +-
>   drivers/target/loopback/tcm_loop.c |  8 +---
>   drivers/usb/storage/uas.c          |  8 ++--
>   include/scsi/scsi_cmnd.h           | 67 ++++++++++++++++++++--------
>   include/scsi/scsi_host.h           |  2 +
>   10 files changed, 101 insertions(+), 102 deletions(-)

I have been running v2 against the scsi_debug driver mainly doing
XDWRITEREAD(10)s with the odd INQUIRY on Martin's 5.1/scsi-queue
branch with my sg v4 driver (20190118 version) for 2 hours. So far
no sign of problems or memory usage expansion.

A script is running this command:
    sg_tst_bidi -d=4 -q=64 -N -vv -l=0x123 -Q -R=64 /dev/sg1

every 3 seconds was the test. That utility can be found in sg3_utils-1.45
beta rev 808 (testing directory) linked at the top of:
    http://sg.danny.cz/sg/

It is queuing up 64 SG_IOSUBMITs (nearly all XDWRITEREAD(10)s) then
reading their responses back and checking for errors. That is repeated
64 times (-R=64). That was the test that crashed v1 of this patch.

Also Boaz Harrosh confirmed to me that without this patchset (or v1)
exofs tests "blew up" when SCSI errors were injected (as predicted).
So Boaz, could you apply this patchset and try those tests again.

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

Please apply this to all patches in this set.