sock/uring: Fix the defect of using is_zcopy field in task.

There is a defect related with the paramater passing.
We should use a variable to store the value first.
We should not directly pass task->zcopy to this function and
reset this variable after the function, because we want to avoid the
recursive calling issue.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I674eb8c6d56704d6508e5753edb6d9233f6f434a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15378
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Ziye Yang 2022-11-10 07:53:54 +00:00 committed by Konrad Sztyber
parent 817c39a1a2
commit 3b7f390941

View File

@ -1122,6 +1122,7 @@ sock_uring_group_reap(struct spdk_uring_sock_group_impl *group, int max, int max
struct spdk_uring_sock *sock, *tmp;
struct spdk_uring_task *task;
int status;
bool is_zcopy;
for (i = 0; i < max; i++) {
ret = io_uring_peek_cqe(&group->uring, &cqe);
@ -1170,12 +1171,13 @@ sock_uring_group_reap(struct spdk_uring_sock_group_impl *group, int max, int max
case SPDK_SOCK_TASK_WRITE:
task->last_req = NULL;
task->iov_cnt = 0;
is_zcopy = task->is_zcopy;
task->is_zcopy = false;
if (spdk_unlikely(status) < 0) {
sock->connection_status = status;
spdk_sock_abort_requests(&sock->base);
} else {
sock_complete_write_reqs(&sock->base, status, task->is_zcopy);
sock_complete_write_reqs(&sock->base, status, is_zcopy);
}
break;