Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5827636imb; Fri, 8 Mar 2019 03:17:34 -0800 (PST) X-Google-Smtp-Source: APXvYqyJGFv+vhY3u9yNqe0IK4GjxHxHIxsId0ZNffdu7baoaPdMoECqHbFUaxd6B/J/ddLacvi4 X-Received: by 2002:aa7:8c97:: with SMTP id p23mr18302155pfd.229.1552043854241; Fri, 08 Mar 2019 03:17:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552043854; cv=none; d=google.com; s=arc-20160816; b=gTaC83FNtilrzX1B7MUQTRFF6iHWDItqhFGFY3RfigHVQHpRCmefZPGRmCgk4C72vH kqROS5O1ed6YF4QbIvRUrzGwdv9ejVMKFbwt/ZXY93dZvIEJR5OKJvgT4kAqAV/4UqS/ AAco65Tyy1+auNW5L61pKkqVo/hRc0J90TB0PXqpet86Rxqv27mfjxbYtwxqP7YoBRaO y4cJFOOCV6QxQXxUUlKU55n6+dA7qRPyPveW2Ewdd1pwXtRc98yMKtqdvcGqTe1Abh5Q +7UaIe+BI0GlkwnQGtIEg9406bEEXD+BumxQzVU1jv03vVfn69TTRpJuPYUeqBrzi1p6 bI/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=LT53i/7QKl/cNVEXH+/sa3JC6Pue5X898TVMgRiux48=; b=g5MICsUD30uuipeulca1eC5pg3sxvAY5QNu7RRTlvFPsjxqgJiEssi4h2RjQjkJu0F /9BcgsB2NXP+T7tNaqfKXpphege58hqgG0rvKKu7rZtUBAiMdSX3SehDmPFsW5C0133D fu90FedUd/7ZiR0y7Nu8dTivPJStXYY9sR5L+XtShyCDlX8z/NCVwz2h4e3paLxweIuo 1w0thM8NJU9D68K60Qy6xsQRtRtFqLXSyYWrM223OiW8Kcl8m99O7PCu2twLerDEnttk nviIXXekNPVIkj9OJQpvNZFgya7wm2KIhHAZsFykrkGYOQEmRyPjsdRQEcslScOFPO9q S80Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11si6701015plq.264.2019.03.08.03.17.07; Fri, 08 Mar 2019 03:17:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726342AbfCHLQh (ORCPT + 99 others); Fri, 8 Mar 2019 06:16:37 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:54378 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725789AbfCHLQh (ORCPT ); Fri, 8 Mar 2019 06:16:37 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 352A85FDFA920979826A; Fri, 8 Mar 2019 19:16:35 +0800 (CST) Received: from [127.0.0.1] (10.184.213.217) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 8 Mar 2019 19:16:25 +0800 Subject: Re: [PATCH 2/8] aio_poll_wake(): don't set ->woken if we ignore the wakeup To: Al Viro , Linus Torvalds CC: Eric Dumazet , David Miller , Jason Baron , , , , Linux List Kernel Mailing , Netdev , , , , Christoph Hellwig , , , , , References: <20190307000316.31133-1-viro@ZenIV.linux.org.uk> <20190307000316.31133-2-viro@ZenIV.linux.org.uk> <20190307021844.GC2217@ZenIV.linux.org.uk> From: "zhengbin (A)" Message-ID: Date: Fri, 8 Mar 2019 19:16:28 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20190307021844.GC2217@ZenIV.linux.org.uk> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.184.213.217] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org So, what should we do? On 2019/3/7 10:18, Al Viro wrote: > On Thu, Mar 07, 2019 at 12:03:10AM +0000, Al Viro wrote: >> From: Al Viro >> >> In case of early wakeups, aio_poll() assumes that aio_poll_complete() >> has either already happened or is imminent. In that case we do not >> want to put iocb on the list of cancellables. However, ignored >> wakeups need to be treated as if wakeup has not happened at all. >> Trivially fixed by having aio_poll_wake() set ->woken only after >> it's committed to taking iocb out of the waitqueue. >> >> Spotted-by: zhengbin >> Signed-off-by: Al Viro > > ... and unfortunately it's worse than just that - what both of us > have missed is that one could have non-specific wakep + schedule_work + > aio_poll_complete_work() rechecking ->poll(), seeing nothing of > interest and reinserting into queue. All before vfs_poll() manages > to return into aio_poll(). The window is harder to hit, but it's > still there, with exact same "failed to add to cancel list" kind of bug > if we do hit it ;-/ > > . >