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 <benjamin.walker@intel.com>
Change-Id: Ia0ba86012f7c6dfd14eb43ba6eeed94dbbce90ce
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6744
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:41:37 -07:00 committed by Tomasz Zawadzki
parent 8e7d559283
commit 01aa5cb385

View File

@ -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);
}