sock/posix: When a socket has no recv_pipe, reading should still clear

from pending_recv list

If the upper layer performs a read/recv, it should still remove the
socket from the pending_recv list.

Change-Id: I32ca8ecccbfe1e53ecc7d6f57343c2727e84b851
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6743
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Ben Walker 2021-03-04 15:36:40 -07:00 committed by Tomasz Zawadzki
parent 18020ec73b
commit 8e7d559283

View File

@ -923,10 +923,15 @@ static ssize_t
posix_sock_readv(struct spdk_sock *_sock, struct iovec *iov, int iovcnt)
{
struct spdk_posix_sock *sock = __posix_sock(_sock);
struct spdk_posix_sock_group_impl *group = __posix_group_impl(sock->base.group_impl);
int rc, i;
size_t len;
if (sock->recv_pipe == NULL) {
if (group && sock->pending_recv) {
sock->pending_recv = false;
TAILQ_REMOVE(&group->pending_recv, sock, link);
}
return readv(sock->fd, iov, iovcnt);
}