]> git.karo-electronics.de Git - linux-beck.git/commit
target: Report correct response length for some commands
authorRoland Dreier <roland@purestorage.com>
Tue, 10 Jun 2014 18:07:47 +0000 (11:07 -0700)
committerNicholas Bellinger <nab@linux-iscsi.org>
Wed, 11 Jun 2014 19:15:30 +0000 (12:15 -0700)
commit2426bd456a61407388b6e61fc5f98dbcbebc50e2
tree4d074c38acefad0aca18b9da752bec2abb6476a7
parentc52716defd6ec7e89c510c740de7ec3478008f28
target: Report correct response length for some commands

When an initiator sends an allocation length bigger than what its
command consumes, the target should only return the actual response data
and set the residual length to the unused part of the allocation length.

Add a helper function that command handlers (INQUIRY, READ CAPACITY,
etc) can use to do this correctly, and use this code to get the correct
residual for commands that don't use the full initiator allocation in the
handlers for READ CAPACITY, READ CAPACITY(16), INQUIRY, MODE SENSE and
REPORT LUNS.

This addresses a handful of failures as reported by Christophe with
the Windows Certification Kit:

  http://permalink.gmane.org/gmane.linux.scsi.target.devel/6515

Signed-off-by: Roland Dreier <roland@purestorage.com>
Tested-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr>
Cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_sbc.c
drivers/target/target_core_spc.c
drivers/target/target_core_transport.c
include/target/target_core_backend.h