Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 904f0bc4 authored by Nicholas Bellinger's avatar Nicholas Bellinger Committed by James Bottomley
Browse files

[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: default avatarBen Jarvis <bjarvismn@gmail.com>
Signed-off-by: default avatarSigned-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Cc: stable@kernel.org
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 853e2bd2
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -667,7 +667,13 @@ target_emulate_readcapacity(struct se_cmd *cmd)
{
{
	struct se_device *dev = SE_DEV(cmd);
	struct se_device *dev = SE_DEV(cmd);
	unsigned char *buf = cmd->t_task->t_task_buf;
	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[0] = (blocks >> 24) & 0xff;
	buf[1] = (blocks >> 16) & 0xff;
	buf[1] = (blocks >> 16) & 0xff;