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

Pete Wyckoff pw
Sat Aug 18 17:57:16 CEST 2007


tomof at acm.org wrote on Sun, 19 Aug 2007 00:08 +0900:
> I still can't understand how the git head is broken (that is, 
> what does this new "iscsi fix xmit param" patch fix?).

Bit different when looking at HEAD, but still a bit broken.

iscsi/param.c:   mxdsl = 8192
iscsi/target.c:  mxdsl = 8192

and this code in iscsi/iscsid.c:

	if (p[i].state == KEY_STATE_START && p[i].val != session_keys[i].def) {
		if (conn->state == STATE_LOGIN) {
			if (i == ISCSI_PARAM_MAX_XMIT_DLENGTH) {
				if (p[i].val > session_keys[i].def)
					p[i].val = session_keys[i].def;
				p[i].state = KEY_STATE_DONE;
				continue;
			}
			memset(buf, 0, sizeof(buf));
			param_val_to_str(session_keys, i, p[i].val,
					 buf);
			text_key_add(conn, session_keys[i].name, buf);
			p[i].state = KEY_STATE_REQUEST;
		}
		cnt++;
	}

(p[] is conn->session_param, which is initialized from target params
then modified by negotiation.)

If target admin does not change target mxdsl, and initiator does not
send mrdsl, this code will see 8192 == 8192 and use 8192.  Fine,
that's the default.

If target admin changes target mxdsl to 16384 using tgtadm, and
initiator does not send mrdsl, this code will see 16384 != 8192.
Then the ">" will shrink it back to 8192.  Good.

Now what if target admin changes mxdsl to 16384 using tgtadm.  And
initiator sends mrdsl 16384.  Minimum of these leads to target
accepting 16384 up in text_scan_login.  Then this code sees 16384 !=
8192, and that 16384 > 8192, thus shrinks it back to 8192.  So
although both initiator and target are willing to use bigger mrdsl,
they cannot.

Patch fixes that.

		-- Pete



More information about the stgt mailing list