fs: dlm: retry accept() until -EAGAIN or error returns

This patch fixes a race if we get two times an socket data ready event
while the listen connection worker is queued. Currently it will be
served only once but we need to do it (in this case twice) until we hit
-EAGAIN which tells us there is no pending accept going on.

This patch wraps an do while loop until we receive a return value which
is different than 0 as it was done before commit d11ccd451b ("fs: dlm:
listen socket out of connection hash").

Cc: stable@vger.kernel.org
Fixes: d11ccd451b ("fs: dlm: listen socket out of connection hash")
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
Alexander Aring 2022-10-27 16:45:12 -04:00 committed by David Teigland
parent 08ae0547e7
commit f0f4bb431b
1 changed files with 5 additions and 1 deletions

View File

@ -1543,7 +1543,11 @@ static void process_recv_sockets(struct work_struct *work)
static void process_listen_recv_socket(struct work_struct *work) static void process_listen_recv_socket(struct work_struct *work)
{ {
accept_from_sock(&listen_con); int ret;
do {
ret = accept_from_sock(&listen_con);
} while (!ret);
} }
static void dlm_connect(struct connection *con) static void dlm_connect(struct connection *con)