]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
target: Fix range calculation in WRITE SAME emulation when num blocks == 0
authorRoland Dreier <roland@purestorage.com>
Tue, 17 Jul 2012 00:10:17 +0000 (17:10 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 25 Jul 2012 03:11:25 +0000 (04:11 +0100)
commit1edae5d5207b5c11e734a465fd0d8618952f74b4
tree4bea3cf54ce08981fa4c1d28fc8a35f31b098c7e
parent6154c5bc1f1c0e02dd41bd96300c63e137bdee51
target: Fix range calculation in WRITE SAME emulation when num blocks == 0

commit 1765fe5edcb83f53fc67edeb559fcf4bc82c6460 upstream.

When NUMBER OF LOGICAL BLOCKS is 0, WRITE SAME is supposed to write
all the blocks from the specified LBA through the end of the device.
However, dev->transport->get_blocks(dev) (perhaps confusingly) returns
the last valid LBA rather than the number of blocks, so the correct
number of blocks to write starting with lba is

dev->transport->get_blocks(dev) - lba + 1

(nab: Backport roland's for-3.6 patch to for-3.5)

Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/target/target_core_cdb.c