summaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2011-03-02 15:52:51 -0800
committerJames Bottomley <James.Bottomley@suse.de>2011-03-14 18:31:08 -0500
commit904f0bc482201fa86e75c330d79dfd11be494cf8 (patch)
tree150fa17a137ecc22c22accf126c61e9dd79d354b /drivers/target
parent853e2bd2103aaa91d1ba1c0b57ba17628d836f03 (diff)
downloadlinux-stable-904f0bc482201fa86e75c330d79dfd11be494cf8.tar.gz
linux-stable-904f0bc482201fa86e75c330d79dfd11be494cf8.tar.bz2
linux-stable-904f0bc482201fa86e75c330d79dfd11be494cf8.zip
[SCSI] target: Fix volume size misreporting for volumes > 2TB
the target infrastructure fails to send the correct conventional size to READ_CAPACITY that force a retry with READ_CAPACITY_16, which reads the capacity for devices > 2TB. Fix by adding the correct return to trigger RC(16). Reported-by: Ben Jarvis <bjarvismn@gmail.com> Signed-off-by: Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org> Cc: stable@kernel.org Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_cdb.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c
index 366080baf474..7f19c8b7b84c 100644
--- a/drivers/target/target_core_cdb.c
+++ b/drivers/target/target_core_cdb.c
@@ -667,7 +667,13 @@ target_emulate_readcapacity(struct se_cmd *cmd)
{
struct se_device *dev = SE_DEV(cmd);
unsigned char *buf = cmd->t_task->t_task_buf;
- u32 blocks = dev->transport->get_blocks(dev);
+ unsigned long long blocks_long = dev->transport->get_blocks(dev);
+ u32 blocks;
+
+ if (blocks_long >= 0x00000000ffffffff)
+ blocks = 0xffffffff;
+ else
+ blocks = (u32)blocks_long;
buf[0] = (blocks >> 24) & 0xff;
buf[1] = (blocks >> 16) & 0xff;