lkml.org 
[lkml]   [2012]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[ 062/149] tcm_loop: Set residual field for SCSI commands
    3.2-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Roland Dreier <roland@purestorage.com>

    commit 6cf3fa6918baab0c447f1206f1cef9166ad04864 upstream.

    If the target core signals an over- or under-run, tcm_loop should call
    scsi_set_resid() to tell the SCSI midlayer about the residual data length.

    The difference can be seen by doing something like

    strace -eioctl sg_raw -r 1024 /dev/sda 8 0 0 0 1 0 > /dev/null

    and looking at the "resid=" part of the SG_IO ioctl -- after this patch,
    the field is correctly reported as 512.

    Signed-off-by: Roland Dreier <roland@purestorage.com>
    Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/target/loopback/tcm_loop.c | 6 ++++++
    1 file changed, 6 insertions(+)

    --- a/drivers/target/loopback/tcm_loop.c
    +++ b/drivers/target/loopback/tcm_loop.c
    @@ -866,6 +866,9 @@ static int tcm_loop_queue_data_in(struct

    sc->result = SAM_STAT_GOOD;
    set_host_byte(sc, DID_OK);
    + if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) ||
    + (se_cmd->se_cmd_flags & SCF_UNDERFLOW_BIT))
    + scsi_set_resid(sc, se_cmd->residual_count);
    sc->scsi_done(sc);
    return 0;
    }
    @@ -891,6 +894,9 @@ static int tcm_loop_queue_status(struct
    sc->result = se_cmd->scsi_status;

    set_host_byte(sc, DID_OK);
    + if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) ||
    + (se_cmd->se_cmd_flags & SCF_UNDERFLOW_BIT))
    + scsi_set_resid(sc, se_cmd->residual_count);
    sc->scsi_done(sc);
    return 0;
    }



    \
     
     \ /
      Last update: 2012-03-31 00:25    [W:0.031 / U:126.428 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site