From 0e4690236bccbda4778c990b8090c118fd31359c Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 23 Apr 2021 19:52:29 +0000 Subject: [PATCH] sock/posix: return error immediately if epoll_ctl fails We do not want to do any further work on adding the sock to the group if the epoll_ctl (or kevent) fails. Signed-off-by: Jim Harris Change-Id: I44b6dc86ce5676aa1b8d6c50b86f22758e4e37fa Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7594 Reviewed-by: Tomasz Zawadzki Reviewed-by: Ben Walker Reviewed-by: Aleksey Marchuk Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot --- 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 7118eebe5..9b763952a 100644 --- a/module/sock/posix/posix.c +++ b/module/sock/posix/posix.c @@ -1181,6 +1181,10 @@ posix_sock_group_impl_add_sock(struct spdk_sock_group_impl *_group, struct spdk_ rc = kevent(group->fd, &event, 1, NULL, 0, &ts); #endif + if (rc != 0) { + return rc; + } + /* switched from another polling group due to scheduling */ if (spdk_unlikely(sock->recv_pipe != NULL && (spdk_pipe_reader_bytes_available(sock->recv_pipe) > 0))) {