Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2469148pxj; Mon, 10 May 2021 03:51:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCBOkwW7MnS7RjvfEMKGihuch0WHEv+M2+sK7qU5I/V28Ybc5AjXIXWlyTrvDEnh3zouVx X-Received: by 2002:a17:906:2559:: with SMTP id j25mr24364700ejb.42.1620643906967; Mon, 10 May 2021 03:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620643906; cv=none; d=google.com; s=arc-20160816; b=S3AD3fcSkvPMfp1R+WIUlxhIX7dLN2HJIFw//8kAgBoZpPKREBjOUnYIz1TkxGkaT+ EskM7GXdnlpGDCp/cGn0WwBdGTpYAXqCnbDvHKVpDx/gY1OaqcN5279TSPcUlQDt9YrL qfovRtd3Ugy9P2211o2GCD8HoVHno59uMxPm3O8jkf3rUEYgUwl7JpyCy/cgN5FIadgI MsD+LDIXjkD5Qbc5YyYnQr5IjyySlkFUlqfEV/RifhiTFi1Qk6miCAwZpDLIaW7JrdHu P0XgHopALXi+S1YdLUfzvzuizE+e941rovZu5DeIML/qdzx0J9R1YxA+xhIJsD1YNYhM QEuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9vjATHIEbQqJVh+qMZyWwwSq8Vjb4++64+cLX3gfOX4=; b=SV0rTPRwEFIT61PYZ1xQxAdOtWFVABo9ePJq4LO8GJhVjuciOJ8ONMxmdMaVgqfNXb e2jZTbeOsRMhq/IGCM4iYVQFTmG5G2W5U/bYKaGD+x0h431ul1WGfKm9T0wu5WEXpZC8 UtsCpbFx3QJk4xgasNEpjpC9EA22/O97qAquOSuRDklq72k516vC8O14dOq3ul7vT76F 9RopQAOTnF1mLWnG4HAWuwDc3inISsL1M7OPUW+6eOLDTD6nAez7U7y7B2cELyZiv4B1 gKKb8yr6SBBv5wAelMcVtkShyRipt1VlSAjaccwq0h2yiasU7jHnOAnMJ9biVUixAbTj TqGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ObTDX2Ou; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l17si12637473edw.46.2021.05.10.03.51.23; Mon, 10 May 2021 03:51:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ObTDX2Ou; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232146AbhEJKuq (ORCPT + 99 others); Mon, 10 May 2021 06:50:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:48980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233014AbhEJKlA (ORCPT ); Mon, 10 May 2021 06:41:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B3EC961288; Mon, 10 May 2021 10:31:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642702; bh=ABg27/KuCtxNVCKLZIB70j1evir5XI3Ogh0w7OMh47U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ObTDX2OuIQd7ZaQ/Vhz+1viAl48/XLHzHasRlQv+vdBVka6nVdxeceFOY3T2f/dEI 2SmJgs2xmbqnuqq2q3iLXbAnwNtT/KuEtEK9kWM4HK3p2MtuIbHpRmkehPfYZ0UfKg xF1l1Xc0+rShBzMGfWDtsBVwnkhkTKKN2VHPYAq0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Davidlohr Bueso , Al Viro , Jason Baron , Roman Penyaev , Andrew Morton , Linus Torvalds Subject: [PATCH 5.10 017/299] fs/epoll: restore waking from ep_done_scan() Date: Mon, 10 May 2021 12:16:54 +0200 Message-Id: <20210510102005.414063403@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Davidlohr Bueso commit 7fab29e356309ff93a4b30ecc466129682ec190b upstream. Commit 339ddb53d373 ("fs/epoll: remove unnecessary wakeups of nested epoll") changed the userspace visible behavior of exclusive waiters blocked on a common epoll descriptor upon a single event becoming ready. Previously, all tasks doing epoll_wait would awake, and now only one is awoken, potentially causing missed wakeups on applications that rely on this behavior, such as Apache Qpid. While the aforementioned commit aims at having only a wakeup single path in ep_poll_callback (with the exceptions of epoll_ctl cases), we need to restore the wakeup in what was the old ep_scan_ready_list() such that the next thread can be awoken, in a cascading style, after the waker's corresponding ep_send_events(). Link: https://lkml.kernel.org/r/20210405231025.33829-3-dave@stgolabs.net Fixes: 339ddb53d373 ("fs/epoll: remove unnecessary wakeups of nested epoll") Signed-off-by: Davidlohr Bueso Cc: Al Viro Cc: Jason Baron Cc: Roman Penyaev Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/eventpoll.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -746,6 +746,12 @@ static __poll_t ep_scan_ready_list(struc */ list_splice(&txlist, &ep->rdllist); __pm_relax(ep->ws); + + if (!list_empty(&ep->rdllist)) { + if (waitqueue_active(&ep->wq)) + wake_up(&ep->wq); + } + write_unlock_irq(&ep->lock); if (!ep_locked)