iscsi-initiator-utils/iscsi-initiator-utils-fix-zero-MaxXmitDataSegmentLength.patch

42 lines
1.5 KiB
Diff
Raw Normal View History

2010-04-01 01:52:24 +00:00
diff --git a/usr/initiator.c b/usr/initiator.c
index 1c9d8b6..70c873b 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -368,9 +368,10 @@ iscsi_copy_operational_params(iscsi_conn_t *conn)
/* zero indicates to use the target's value */
conn->max_xmit_dlength =
__padding(conn_rec->iscsi.MaxXmitDataSegmentLength);
- if (conn->max_xmit_dlength != 0 &&
- (conn->max_xmit_dlength < ISCSI_MIN_MAX_RECV_SEG_LEN ||
- conn->max_xmit_dlength > ISCSI_MAX_MAX_RECV_SEG_LEN)) {
+ if (conn->max_xmit_dlength == 0)
+ conn->max_xmit_dlength = ISCSI_DEF_MAX_RECV_SEG_LEN;
+ if (conn->max_xmit_dlength < ISCSI_MIN_MAX_RECV_SEG_LEN ||
+ conn->max_xmit_dlength > ISCSI_MAX_MAX_RECV_SEG_LEN) {
log_error("Invalid iscsi.MaxXmitDataSegmentLength. Must be "
"within %u and %u. Setting to %u\n",
ISCSI_MIN_MAX_RECV_SEG_LEN,
diff --git a/usr/login.c b/usr/login.c
index 4f891de..be19b9e 100644
--- a/usr/login.c
+++ b/usr/login.c
@@ -390,9 +390,14 @@ get_op_params_text_keys(iscsi_session_t *session, int cid,
if (session->type == ISCSI_SESSION_TYPE_DISCOVERY ||
!session->t->template->rdma) {
int tgt_max_xmit;
+ conn_rec_t *conn_rec = &session->nrec.conn[cid];
tgt_max_xmit = strtoul(value, NULL, 0);
- if (conn->max_xmit_dlength == 0 ||
+ /*
+ * if the rec value is zero it means to use
+ * what the target gave us.
+ */
+ if (!conn_rec->iscsi.MaxXmitDataSegmentLength ||
tgt_max_xmit < conn->max_xmit_dlength)
conn->max_xmit_dlength = tgt_max_xmit;
}
--
1.6.6.1