From: Alexander Aring Date: Thu, 27 Oct 2022 20:45:12 +0000 (-0400) Subject: fs: dlm: retry accept() until -EAGAIN or error returns X-Git-Tag: v5.15.92~657 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b2120ed7fd75157a6d83d0671ddf2050627718e3;p=platform%2Fkernel%2Flinux-rpi.git fs: dlm: retry accept() until -EAGAIN or error returns commit f0f4bb431bd543ed7bebbaea3ce326cfcd5388bc upstream. 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 d11ccd451b65 ("fs: dlm: listen socket out of connection hash"). Cc: stable@vger.kernel.org Fixes: d11ccd451b65 ("fs: dlm: listen socket out of connection hash") Signed-off-by: Alexander Aring Signed-off-by: David Teigland Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 55e4510..d56a8f8 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1520,7 +1520,11 @@ static void process_recv_sockets(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)