Commit b67aa514 authored by Ben Walker's avatar Ben Walker Committed by Tomasz Zawadzki
Browse files

sock/posix: No longer remove sockets from pending_recv in poll



This seems to be cleaning up the pending_recv list to account for the
missed cases in the previous patches in this series. Now that we're
correctly cleaning up the list, don't do this.

Note that if an EPOLLIN event is received but the application never does
a read/recv, the socket will remain in the pending recv list. The next
poll will get another EPOLLIN event, but the logic already handles that
case.

Additionally, left a TODO for a performance optimization.

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 8ac5f9e9
Loading
Loading
Loading
Loading
+7 −14
Original line number Diff line number Diff line
@@ -1215,13 +1215,10 @@ posix_sock_group_impl_remove_sock(struct spdk_sock_group_impl *_group, struct sp
	struct spdk_posix_sock *sock = __posix_sock(_sock);
	int rc;

	if (sock->recv_pipe != NULL) {
		if (spdk_pipe_reader_bytes_available(sock->recv_pipe) > 0) {
	if (sock->pending_recv) {
		TAILQ_REMOVE(&group->pending_recv, sock, link);
		sock->pending_recv = false;
	}
		assert(sock->pending_recv == false);
	}

#if defined(SPDK_EPOLL)
	struct epoll_event event;
@@ -1343,20 +1340,16 @@ posix_sock_group_impl_poll(struct spdk_sock_group_impl *_group, int max_events,
	}

	/* Cycle the pending_recv list so that each time we poll things aren't
	 * in the same order. */
	 * in the same order.
	 * TODO: This could be done with a single operation because psock points
	 * to the last node that needs to get cycled already. */
	for (i = 0; i < num_events; i++) {
		psock = __posix_sock(socks[i]);

		TAILQ_REMOVE(&group->pending_recv, psock, link);

		if (psock->recv_pipe == NULL || spdk_pipe_reader_bytes_available(psock->recv_pipe) == 0) {
			psock->pending_recv = false;
		} else {
		TAILQ_INSERT_TAIL(&group->pending_recv, psock, link);
	}

	}

	return num_events;
}