target/file: Fix off-by-one READ_CAPACITY bug for !S_ISBLK export
authorNicholas Bellinger <nab@linux-iscsi.org>
Thu, 30 May 2013 04:35:23 +0000 (21:35 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Jun 2013 19:53:36 +0000 (12:53 -0700)
commit0813b7c39d5d046feb9e7a632abd09aaafae056e
treeaa9f7a9cb03ef26357bd3647c4d14004815f0ea6
parentbefb0ab8d1a9f51fb1682aaec9f0ab0eb23228e8
target/file: Fix off-by-one READ_CAPACITY bug for !S_ISBLK export

commit 21363ca873334391992f2f424856aa864345bb61 upstream.

This patch fixes a bug where FILEIO was incorrectly reporting the number
of logical blocks (+ 1) when using non struct block_device export mode.

It changes fd_get_blocks() to follow all other backend ->get_blocks() cases,
and reduces the calculated dev_size by one dev->dev_attrib.block_size
number of bytes, and also fixes initial fd_block_size assignment at
fd_configure_device() time introduced in commit 0fd97ccf4.

Reported-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reported-by: Badari Pulavarty <pbadari@us.ibm.com>
Tested-by: Badari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Lingzhu Xiang <lxiang@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/target/target_core_file.c