lib/iscsi: Assert if conn->data_out_cnt goes negative or left positive
conn->data_out_cnt does not control anything now but adding assert for conn->data_out_cnt will be helpful at least to ensure that the current SPDK works correctly. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I31ee90769ce0555e64bd41c283e8b437326efebf Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476409 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
parent
b24bd0390a
commit
9e1fe1ba70
@ -602,6 +602,7 @@ iscsi_conn_stop(struct spdk_iscsi_conn *conn)
|
||||
|
||||
assert(conn->state == ISCSI_CONN_STATE_EXITED);
|
||||
assert(conn->data_in_cnt == 0);
|
||||
assert(conn->data_out_cnt == 0);
|
||||
|
||||
if (conn->sess != NULL &&
|
||||
conn->sess->session_type == SESSION_TYPE_NORMAL &&
|
||||
|
@ -2804,6 +2804,7 @@ spdk_del_transfer_task(struct spdk_iscsi_conn *conn, uint32_t task_tag)
|
||||
for (i = 0; i < conn->pending_r2t; i++) {
|
||||
if (conn->outstanding_r2t_tasks[i]->tag == task_tag) {
|
||||
task = conn->outstanding_r2t_tasks[i];
|
||||
assert(conn->data_out_cnt >= task->data_out_cnt);
|
||||
conn->data_out_cnt -= task->data_out_cnt;
|
||||
|
||||
conn->pending_r2t--;
|
||||
@ -2866,6 +2867,7 @@ void spdk_clear_all_transfer_task(struct spdk_iscsi_conn *conn,
|
||||
task->outstanding_r2t = 0;
|
||||
task->next_r2t_offset = 0;
|
||||
task->next_expected_r2t_offset = 0;
|
||||
assert(conn->data_out_cnt >= task->data_out_cnt);
|
||||
conn->data_out_cnt -= task->data_out_cnt;
|
||||
conn->pending_r2t--;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user