target: Fix bug in handling of FILEIO + block_device resize ops
authorNicholas Bellinger <nab@linux-iscsi.org>
Wed, 16 May 2012 23:05:26 +0000 (16:05 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 20 May 2012 21:56:51 +0000 (22:56 +0100)
commitdc73d6c2c18e06f2b89401a12ad0a8976462901a
tree5e76fb4d732950ccad212e178062bcf936cadac9
parentad87af4331c0b242788fbf668eefe2e311f2cd7f
target: Fix bug in handling of FILEIO + block_device resize ops

commit cd9323fd68aee3c1c6b5b21e5746c9d1b586fb58 upstream.

This patch fixes a bug in the handling of FILEIO w/ underlying block_device
resize operations where the original fd_dev->fd_dev_size was incorrectly being
used in fd_get_blocks() for READ_CAPACITY response payloads.

This patch avoids using fd_dev->fd_dev_size for FILEIO devices with
an underlying block_device, and instead changes fd_get_blocks() to
get the sector count directly from i_size_read() as recommended by hch.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/target/target_core_file.c