Commit c5b497f2 authored by Ben Walker's avatar Ben Walker Committed by Jim Harris
Browse files

sock/uring: Correctly report pending events when a socket error occurs



Before I think this worked because the POLLIN completes when there is a
sock error.

Change-Id: I0bd493a26bcbf8cbdf9b9652b46d3d877c0dfbfb
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/18063


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 87f1c346
Loading
Loading
Loading
Loading
+17 −13
Original line number Diff line number Diff line
@@ -1194,10 +1194,24 @@ sock_uring_group_reap(struct spdk_uring_sock_group_impl *group, int max, int max

		task->status = SPDK_URING_SOCK_TASK_NOT_IN_USE;

		if (spdk_unlikely(status <= 0)) {
			if (status == -EAGAIN || status == -EWOULDBLOCK || (status == -ENOBUFS && sock->zcopy)) {
		if (spdk_unlikely(status < 0)) {
			if (status == -EAGAIN || status == -EWOULDBLOCK ||
			    (status == -ENOBUFS && sock->zcopy) ||
			    status == -ECANCELED) {
				continue;
			}

			sock->connection_status = status;
			spdk_sock_abort_requests(&sock->base);

			/* The user needs to be notified that this socket is dead. */
			if (sock->base.cb_fn != NULL &&
			    sock->pending_recv == false) {
				sock->pending_recv = true;
				TAILQ_INSERT_TAIL(&group->pending_recv, sock, link);
			}

			continue;
		}

		switch (task->type) {
@@ -1222,20 +1236,10 @@ sock_uring_group_reap(struct spdk_uring_sock_group_impl *group, int max, int max
			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, is_zcopy);
			}

			break;
#ifdef SPDK_ZEROCOPY
		case SPDK_SOCK_TASK_ERRQUEUE:
			if (spdk_unlikely(status == -ECANCELED)) {
				sock->connection_status = status;
				break;
			}
			_sock_check_zcopy(&sock->base, status);
			break;
#endif