Skip to content

Commit 904f0bc

Browse files
Nicholas BellingerJames Bottomley
authored andcommitted
[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>
1 parent 853e2bd commit 904f0bc

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎drivers/target/target_core_cdb.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,13 @@ target_emulate_readcapacity(struct se_cmd *cmd)
667667
{
668668
struct se_device *dev = SE_DEV(cmd);
669669
unsigned char *buf = cmd->t_task->t_task_buf;
670-
u32 blocks = dev->transport->get_blocks(dev);
670+
unsigned long long blocks_long = dev->transport->get_blocks(dev);
671+
u32 blocks;
672+
673+
if (blocks_long >= 0x00000000ffffffff)
674+
blocks = 0xffffffff;
675+
else
676+
blocks = (u32)blocks_long;
671677

672678
buf[0] = (blocks >> 24) & 0xff;
673679
buf[1] = (blocks >> 16) & 0xff;

0 commit comments

Comments
 (0)