From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A2B8EB64D9 for ; Sat, 17 Jun 2023 08:26:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232990AbjFQI0m (ORCPT ); Sat, 17 Jun 2023 04:26:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229687AbjFQI0l (ORCPT ); Sat, 17 Jun 2023 04:26:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2E171FF6 for ; Sat, 17 Jun 2023 01:26:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6FB7A611C0 for ; Sat, 17 Jun 2023 08:26:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82C60C433C8; Sat, 17 Jun 2023 08:26:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1686990399; bh=CfpTlndASjlBsAy7VxBBmcPRA8Q30rGBLpU68LJOU18=; h=Subject:To:Cc:From:Date:From; b=CzeVZ+95soUeWRmbnjI+bun1H+PegmPIyIJdqhtQe3w8EalfH9hONOUPqCxlVzhFW Gm/3A0tTVVjFrtklozHBopQGN4MhwvJF5W0DdT1uA+5BcbCDYSoW4zu6IYUevnEejK gigyf/2LarqFFUHOjRrivrts0aEFoW0U+NuYfTFE= Subject: FAILED: patch "[PATCH] epoll: ep_autoremove_wake_function should use" failed to apply to 5.4-stable tree To: bsegall@google.com, akpm@linux-foundation.org, brauner@kernel.org, stable@vger.kernel.org, viro@zeniv.linux.org.uk Cc: From: Date: Sat, 17 Jun 2023 10:26:37 +0200 Message-ID: <2023061737-smartness-mummify-9865@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 5.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y git checkout FETCH_HEAD git cherry-pick -x 2192bba03d80f829233bfa34506b428f71e531e7 # git commit -s git send-email --to '' --in-reply-to '2023061737-smartness-mummify-9865@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 2192bba03d80f829233bfa34506b428f71e531e7 Mon Sep 17 00:00:00 2001 From: Benjamin Segall Date: Tue, 30 May 2023 11:32:28 -0700 Subject: [PATCH] epoll: ep_autoremove_wake_function should use list_del_init_careful autoremove_wake_function uses list_del_init_careful, so should epoll's more aggressive variant. It only doesn't because it was copied from an older wait.c rather than the most recent. [bsegall@google.com: add comment] Link: https://lkml.kernel.org/r/xm26bki0ulsr.fsf_-_@google.com Link: https://lkml.kernel.org/r/xm26pm6hvfer.fsf@google.com Fixes: a16ceb139610 ("epoll: autoremove wakers even more aggressively") Signed-off-by: Ben Segall Cc: Al Viro Cc: Christian Brauner Cc: Signed-off-by: Andrew Morton diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 980483455cc0..266d45c7685b 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1805,7 +1805,11 @@ static int ep_autoremove_wake_function(struct wait_queue_entry *wq_entry, { int ret = default_wake_function(wq_entry, mode, sync, key); - list_del_init(&wq_entry->entry); + /* + * Pairs with list_empty_careful in ep_poll, and ensures future loop + * iterations see the cause of this wakeup. + */ + list_del_init_careful(&wq_entry->entry); return ret; }