[stgt] tgtd 1.0.7 and large targets

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Mon Nov 1 16:46:35 CET 2010


On Sun, 31 Oct 2010 16:04:58 -0700
Mike Anderson <andmike at linux.vnet.ibm.com> wrote:

> ronnie sahlberg <ronniesahlberg at gmail.com> wrote:
> > Hi,
> > 
> > I just created a 10TB LUN with latest git for tgtd.
> > And the initiator can successfully see that the disk is 10TB.
> > Using ServiceActionIn/ReportCapacity16 correctly.
> > 
> > 
> > My system is a 64 bit system,  is your box 32 or 64 bit?
> > 
> 
> It looking at gitk between V1.0.6 and V1.0.7 I see that commit
> 551b64ed34dbb43d6d6530a91d122c0b4d0131bd does make a change to
> READ_CAPACITY_16.

Yeah, seems that the commit causes the problem. Old kernels request 12
bytes for READ_CAPACITY_16. So we return invalid data.

READ_CAPACITY_16 is supposed to return 32 bytes but let's accept 12
bytes.

Robert, can you try this patch?

diff --git a/usr/sbc.c b/usr/sbc.c
index 3ca2aae..1f0a6ff 100644
--- a/usr/sbc.c
+++ b/usr/sbc.c
@@ -201,14 +201,16 @@ static int sbc_service_action(int host_no, struct scsi_cmd *cmd)
 {
 	uint32_t *data;
 	uint64_t size;
-	int len = 16;
+	int len = 32;
 
 	if (cmd->scb[1] != SAI_READ_CAPACITY_16)
 		goto sense;
 
-	if (scsi_get_in_length(cmd) < len)
+	if (scsi_get_in_length(cmd) < 12)
 		goto overflow;
 
+	len = min_t(int, len, scsi_get_in_length(cmd));
+
 	data = scsi_get_in_buffer(cmd);
 	memset(data, 0, len);
 


--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list