Re: 0.9.6 released

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ben Greear <greearb@xxxxxxxxxxxxxxx> writes:

> FUJITA Tomonori wrote:
>>
>> Chris Webb (2):
>>       iscsi: fix sendtargets segfault with lots of targets
>>   
> How many targets do you support now?

This patch was reverted for 0.9.6, so tgtd will still fail to export more
than a fairly small number of targets, around 70 for me. However, a simpler
patch did go in, so at least it will no longer segfault when this limit is
exceeded.

If you need to export more than this, and are reasonably confident that your
initiator won't explode if it's passed more than 8k of data (if for example
you've set discovery.sendtargets.iscsi.MaxRecvDataSegmentLength to a
sensibly large value), the following patch will make tgtd grow the
response buffer as large as it needs to be to announce all your targets
all at once:


# HG changeset patch
# User Chris Webb <chris@xxxxxxxxxxxx>
# Date 1240496898 -3600
# Node ID 102da0d529797b0e558f96a34fdbbf0e18b400c4
# Parent  636d7691799cd17d1f1fe26e09974b1283773c3d

Signed-off-by: Chris Webb <chris@xxxxxxxxxxxx>

diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -160,12 +160,18 @@
 	if (!conn->rsp.datasize)
 		conn->rsp.data = conn->rsp_buffer;
 
+	buffer = conn->rsp_buffer;
+
 	if (conn->rsp.datasize + len > INCOMING_BUFSIZE) {
-		log_warning("Dropping key (%s=%s)", key, value);
-		return;
+		buffer = realloc(buffer, conn->rsp.datasize + len);
+		if (buffer)
+			conn->rsp_buffer = buffer;
+		else {
+			log_warning("Dropping key (%s=%s)", key, value);
+			return;
+		}
 	}
 
-	buffer = conn->rsp_buffer;
 	buffer += conn->rsp.datasize;
 	conn->rsp.datasize += len;


I am running with this patch on our targets, as it's the only way I can use
tgtd to export all the devices from them. However, it is more likely to
allow the response to exceed MaxRecvDataSegmentLength than the small
hardcoded 8k limit in the released tgt. (Both stock tgt-0.9.6 and tgt with
this patch incorrectly ignore the MaxRecvDSL that the initiator requests. A
first cut at better behaviour would be to use the MaxRecvDSL as a limit
instead of a hardcoded INCOMING_BUFSIZE.) See the thread rooted at
<20090402234552.GA1927@xxxxxxxxxxxx> for more info:

  http://lists.wpkg.org/pipermail/stgt/2009-April/002874.html

Cheers,

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

[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux