[Stgt-devel] [PATCH] iscsi fix xmit param

FUJITA Tomonori tomof
Sat Sep 15 02:29:47 CEST 2007


On Fri, 14 Sep 2007 17:40:34 -0400
Pete Wyckoff <pw at osc.edu> wrote:

> tomof at acm.org wrote on Tue, 11 Sep 2007 02:31 +0900:
> > On Tue, 4 Sep 2007 16:03:06 -0400
> > Pete Wyckoff <pw at osc.edu> wrote:
> > 
> > > Repair one corner case in MaxRecvDataSegmentLength processing.  Default
> > > target has always kept data segments at 8k, even if the initiator asks
> > > for more.  Some target administrators may increase this by, e.g.:
> > > 
> > >     tgtadm --lld iscsi --mode target --op update --tid 1 \
> > > 	   --name MaxXmitDataSegmentLength --value 262144
> > > 
> > > so that target will generate up to min(initiator-specified RDSL, 256k).
> > > But if such a change is made, and the initiator does not specify RDSL,
> > > which is odd but specification compliant, the target will incorrectly
> > > use 256k instead of 8k.
> > > 
> > > Signed-off-by: Pete Wyckoff <pw at osc.edu>
> > > ---
> > >  usr/iscsi/iscsid.c |   10 +++++++---
> > >  usr/iscsi/iscsid.h |    1 +
> > >  usr/iscsi/target.c |    2 +-
> > >  3 files changed, 9 insertions(+), 4 deletions(-)
> > 
> > What?
> > 
> > As I explained before, I can't understand your description.
> 
> Oh, sorry.  I thought our last go-round ended with my explaining why
> this was necessary.  I'll drop the patch.  It never happens in
> practice.  Open-iscsi always provides MaxRecvDataSegmentLength
> during login, even if it is using the spec. default of 8k.
> Presumably other initiators do so too.

I still don't see what you mean. tgt works with initiators doesn't
provide MaxRecvDataSegmentLength during login. Can you try the
attached patches.
-------------- next part --------------
Index: usr/login.c
===================================================================
--- usr/login.c	(revision 779)
+++ usr/login.c	(working copy)
@@ -1001,10 +1001,10 @@
 						  max_data_length))
 				return 0;
 
-			if (!add_params_provider_specific(session, cid,
-							  pdu, data,
- max_data_length))
-				return 0;
+/* 			if (!add_params_provider_specific(session, cid, */
+/* 							  pdu, data, */
+/*  max_data_length)) */
+/* 				return 0; */
 		} else {
 			sprintf(value, "%d", conn->max_recv_dlength);
 			if (!iscsi_add_text(pdu, data, max_data_length,
-------------- next part --------------
diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index 78846ba..a4844da 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -798,9 +798,11 @@ static void cmnd_finish(struct iscsi_connection *conn)
 	case STATE_SECURITY_FULL:
 		/* fall through */
 	case STATE_LOGIN_FULL:
-		if (conn->session_type == SESSION_NORMAL)
+		if (conn->session_type == SESSION_NORMAL) {
 			conn->state = STATE_KERNEL;
-		else
+			eprintf("target setting %d, result %d\n",
+				conn->session->target->session_param[ISCSI_PARAM_MAX_XMIT_DLENGTH].val, conn->session_param[ISCSI_PARAM_MAX_XMIT_DLENGTH].val);
+		} else
 			conn->state = STATE_FULL;
 		break;
 	}



More information about the stgt mailing list