[stgt] Strange sendtargets behaviour
FUJITA Tomonori
fujita.tomonori at lab.ntt.co.jp
Tue Sep 15 05:32:45 CEST 2009
On Mon, 14 Sep 2009 18:44:54 +0100
Chris Webb <chris at arachsys.com> wrote:
> In case you have problems reproducing this one, the following script run
> straight after boot is sufficient for me, with nothing else running except
> for iscsid so open-iscsi can run:
Thanks a lot for the useful information!
I can reproduce this problem and I think that I found the root
cause. It's not about overrun buffer but tgtd sends a wrong buffer to
initiators.
When text_key_add() realloc conn->rsp_buffer for a long text response,
we need to set conn->rsp.data again (otherwise conn->rsp.data points
to a wrong memory including garbage and sends it later).
I'll add multiple text PDU support later but can you test this minimum
fix?
diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index 79c6e2d..114c680 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -173,9 +173,10 @@ void text_key_add(struct iscsi_connection *conn, char *key, char *value)
if (conn->rsp.datasize + len > INCOMING_BUFSIZE) {
buffer = realloc(buffer, conn->rsp.datasize + len);
- if (buffer)
+ if (buffer) {
conn->rsp_buffer = buffer;
- else
+ conn->rsp.data = conn->rsp_buffer;
+ } else
goto drop;
}
--
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