iscsi: fix the abnormal connection exit
the mobj is allocating from pdu_data_out_pool, if pdu_data_out_pool is exhausted, when the pdu is polled next time, because data_buf_len is modified, iscsi_pdu_payload_read return -1, and the connection will be released. Signed-off-by: lizengwu <786436671@qq.com> Change-Id: I3ee65472f7ddaa357d7952a5b734540f0bc0b216 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15626 Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
ec6d94b674
commit
93967961c8
@ -4614,18 +4614,20 @@ iscsi_pdu_payload_read(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
|||||||
uint32_t read_len;
|
uint32_t read_len;
|
||||||
uint32_t crc32c;
|
uint32_t crc32c;
|
||||||
int rc;
|
int rc;
|
||||||
|
uint32_t data_buf_len;
|
||||||
|
|
||||||
data_len = pdu->data_segment_len;
|
data_len = pdu->data_segment_len;
|
||||||
read_len = data_len - pdu->data_valid_bytes;
|
read_len = data_len - pdu->data_valid_bytes;
|
||||||
|
data_buf_len = pdu->data_buf_len;
|
||||||
|
|
||||||
mobj = pdu->mobj[0];
|
mobj = pdu->mobj[0];
|
||||||
if (mobj == NULL) {
|
if (mobj == NULL) {
|
||||||
if (pdu->data_buf_len <= iscsi_get_max_immediate_data_size()) {
|
if (data_buf_len <= iscsi_get_max_immediate_data_size()) {
|
||||||
pool = g_iscsi.pdu_immediate_data_pool;
|
pool = g_iscsi.pdu_immediate_data_pool;
|
||||||
pdu->data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(iscsi_get_max_immediate_data_size());
|
data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(iscsi_get_max_immediate_data_size());
|
||||||
} else if (pdu->data_buf_len <= SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH) {
|
} else if (data_buf_len <= SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH) {
|
||||||
pool = g_iscsi.pdu_data_out_pool;
|
pool = g_iscsi.pdu_data_out_pool;
|
||||||
pdu->data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
|
data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
|
||||||
} else {
|
} else {
|
||||||
SPDK_ERRLOG("Data(%d) > MaxSegment(%d)\n",
|
SPDK_ERRLOG("Data(%d) > MaxSegment(%d)\n",
|
||||||
data_len, SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
|
data_len, SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
|
||||||
@ -4635,6 +4637,9 @@ iscsi_pdu_payload_read(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
|||||||
if (mobj == NULL) {
|
if (mobj == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pdu->data_buf_len = data_buf_len;
|
||||||
|
|
||||||
pdu->mobj[0] = mobj;
|
pdu->mobj[0] = mobj;
|
||||||
pdu->data = mobj->buf;
|
pdu->data = mobj->buf;
|
||||||
pdu->data_from_mempool = true;
|
pdu->data_from_mempool = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user