Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2531179pxj; Mon, 10 May 2021 05:18:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcFeVj4w+0haD8PecZAoo8kv58tZhX33ayvYh/VMSUZAONvrNNL9L6EBVi89NjnbovIILt X-Received: by 2002:a17:906:251a:: with SMTP id i26mr25627958ejb.367.1620649102518; Mon, 10 May 2021 05:18:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620649102; cv=none; d=google.com; s=arc-20160816; b=BIz1qsSCAk1DSgXgv5JLP0/8Kjm93LbZgEs+5FNfW5YICNM0pLOcJVPUW6m6tlCiJG 4YnLrq5YguVGpJVS2oELfAlnreyLr8RP3dG53wOAkZ6Ou4nfiFCZmXtkIuo72RylHIvi eDNJEJxn8DKbJtNNoQ/gzSh8nzVeFdF9lPcYet49KocedJqEDF9AWimVsrQL/01z6IwS n+XmV5rpno599iOCNzIepr6UgVvP06D9j+musOHuNi1IlraaZKsvx+PiALTpV2nilRU4 qcc4d3pJXJVU8y3kVRpqeFLrokKADFqPFjKZD4flbTEFIT6pPo/HGbayW2/mI1Jp9+87 XCVA== 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=cCC0DBKE8D03anuobqnob14V37q+fHh2xY6fka3JuQY=; b=YrN70PaunLAFEJTGG7tEF5bmO6EEHsJmhsCkaUT5KEhCrn+hOaVXeQrVSKfoQ5uHGe nTn5/KsMtyYQvlfbeJUlolSz1Zh7Grd0KH3cbb1dMxheU9CR7tFXZFgtr4fZlqUvGvUi pT7X48hZEMA9i2Er7xPuzSyjsey1O2+i1LLU2pGaZiuYxyQgqs4Poe5VtU8tTNkPmG5M IbaCUHnsMHOZ7xd7ZqHeMOWji296zu2Gr4FgiNlJhnUqeb9aXFELwo3Lf6Ix2yDXxm/6 3GKZw935MHmag2FC6svTGWuKDYr6/8rnAg0BgQQ35iK31/UTiaIe/lXG3lrGmgJIGDzn N+hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aEKUV5ow; 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 n15si13456467edt.63.2021.05.10.05.17.59; Mon, 10 May 2021 05:18:22 -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=aEKUV5ow; 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 S1344371AbhEJMPh (ORCPT + 99 others); Mon, 10 May 2021 08:15:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:44332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236096AbhEJLHh (ORCPT ); Mon, 10 May 2021 07:07:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7C57F6191F; Mon, 10 May 2021 10:58:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620644294; bh=Io83Kb3ARhTR0rwI6TNaCpzuTfgWzS115D2hkwnVGY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aEKUV5owWKYldLJAQaKiieV730tpOZzWdbtJOkTlMtXo+qqlkhVf4YTIugnRg2eqn zPWKwPXEF8hcjms5Ppva1GGEGniZUHJNXipeX7LUV8w81E+Y7wz4UxAp10vFX7wGNt wO8GmyLLxFc/ux/p5dHmp3740jO935wmwTnyKmiU= 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.12 023/384] fs/epoll: restore waking from ep_done_scan() Date: Mon, 10 May 2021 12:16:52 +0200 Message-Id: <20210510102015.639784691@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102014.849075526@linuxfoundation.org> References: <20210510102014.849075526@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 @@ -657,6 +657,12 @@ static void ep_done_scan(struct eventpol */ 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); }