From 01aa5cb385eb1421f7e1ccf02b694224095d59f5 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Thu, 4 Mar 2021 15:41:37 -0700 Subject: [PATCH] sock/posix: Clear sock from pending_recv even if user does large read If there was an EPOLLIN event the socket gets adding to the pending_recv list. But if the application then does a very large read, it will bypass the logic that clears the socket from the pending_recv list. Fix this. Signed-off-by: Ben Walker Change-Id: Ia0ba86012f7c6dfd14eb43ba6eeed94dbbce90ce Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6744 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- module/sock/posix/posix.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module/sock/posix/posix.c b/module/sock/posix/posix.c index 28831b80b..917cc8b1c 100644 --- a/module/sock/posix/posix.c +++ b/module/sock/posix/posix.c @@ -944,6 +944,10 @@ posix_sock_readv(struct spdk_sock *_sock, struct iovec *iov, int iovcnt) /* If the user is receiving a sufficiently large amount of data, * receive directly to their buffers. */ if (len >= MIN_SOCK_PIPE_SIZE) { + if (group && sock->pending_recv) { + sock->pending_recv = false; + TAILQ_REMOVE(&group->pending_recv, sock, link); + } return readv(sock->fd, iov, iovcnt); }