tcm_loop: Set residual field for SCSI commands
authorRoland Dreier <roland@purestorage.com>
Tue, 14 Feb 2012 23:30:31 +0000 (15:30 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Apr 2012 16:52:44 +0000 (09:52 -0700)
commitbb9ed4f099c534078357b549b53749a55dfd1c97
treee56e610c96e276ba252fbffbde83cde1e4a2d8db
parent0f813454b313d17992a2c8ec7483c733ce5107b3
tcm_loop: Set residual field for SCSI commands

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