Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4543413imb; Wed, 6 Mar 2019 16:30:03 -0800 (PST) X-Google-Smtp-Source: APXvYqwLzDlHYQVEJmzPIrno3tk4WSLxOYgfpJXod1WdkWNV8ikvQAi9Oq3Ln2yltRdzeuoot6q+ X-Received: by 2002:aa7:9099:: with SMTP id i25mr10101634pfa.102.1551918603158; Wed, 06 Mar 2019 16:30:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551918603; cv=none; d=google.com; s=arc-20160816; b=05qJGsmQQAO7ANQIeJADk1ieuAgJApZIjPJuW/9Od4i0c10xpMUCERcC+4vCiPMGLP S6HKlCTc6UOGf0CiL2+2bKF9ciZuzbTX53Dq0EyixEXwqRUkOZUktEG3s0T5dNFU3xnA J00+DYeATSg3hSvjwDXk++vT76DDI9cbPGwnZiND9jAGjUImL80mBWyFwKrsRTXXc6b9 lIhkM4Rzx34H1YT55Q+1MigdqvthbfDu1mMmumH6esCECFNr3Zb8Ppn6DFV8JEJ1NtSq fQfHVjWecLBcYOniSwY/O27JWHKwWkgymMTk9BJpSEmNmBXL2/xIxgWHtgFfQi66lcLJ 1boQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=rbJ0UlggnKYK1jDmFNStqwUyu5vfmirkoF92RcPOO3A=; b=Az8fygOucdAes/jCpcfQDANAdY3sMulw+8k3yAegBi049VYK5qOJeOtuyxwIrUBuQm +ge5cUoZLm2KiDhNb4KGkYVVdkM7t5hkGJIvlZl0rFbzArx1ZticLaloMhRlX2WjtIJe iIU/G/eWJ2ZEkOtq5ioQ8CZRtg/rV+hJm6nPX3j9F9KVoCzTzsQgROyUYeUkT3CEyuM+ tx04Nw4e1A/Uvwdgr7/q20tvi9nJQi+QcHvM/GQSZMnfJajG6YzSPmSg4OSsbiVRNXvS JGg9yt4GCwAAwqSd4ferpnDqVuRgqV4MIiPMDa6CXTS2TBbi7z73cdtX0vRIsX8D6qdH 1xqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=VC4oXkbO; 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 o6si2887520plh.397.2019.03.06.16.29.47; Wed, 06 Mar 2019 16:30:03 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=VC4oXkbO; 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 S1726216AbfCGA3V (ORCPT + 99 others); Wed, 6 Mar 2019 19:29:21 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:36968 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725790AbfCGA3V (ORCPT ); Wed, 6 Mar 2019 19:29:21 -0500 Received: by mail-lj1-f193.google.com with SMTP id a17so12584761ljd.4 for ; Wed, 06 Mar 2019 16:29:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rbJ0UlggnKYK1jDmFNStqwUyu5vfmirkoF92RcPOO3A=; b=VC4oXkbO/4BT0umjvdMgvDLX7CuFfoVAvLnm5BgTSov645gClqahgz2zffcFrfMVhX 6+DENVkH0/MRZ2AI5+KtBKHVjnFaYiHS44hgU2feHhhD82vGdxQYumeXn5B2uf43MSN0 akdOqV0Rgkftl45GuaWSAn7Bdh8b9X0pbOg3U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rbJ0UlggnKYK1jDmFNStqwUyu5vfmirkoF92RcPOO3A=; b=alfQzaO7ko2n8NHsdnVtZkNh0j095lldGxLXs33W5kOX9yR93BtDRlPzX0cCiwTaTY osJPP1adnGyHCuFj/W+nb0bEBJeGpChs9jNraIaI4f3vrqkLUBrfl7ywDWngheuxjuBa NEd4MAoHmoDcHVRplko+VgqJlensSsQtD7kftEqrBxxikAj+p+m9+WTf26qrXDNktTC9 dBmJHDUnV+kigfZHiw3Z3smU90oUOmRU/gEoiSHRZQIrUjWrFxIHMFdBlml53bue1dQO F5XeFxuOQFXVOztIDrJaOTQUbqRbglZpIhBbiSy53KfnuJPjd37GGEVty6BcH05561dV 67FQ== X-Gm-Message-State: APjAAAV48Smk592ceYZqPHZSMPzfp7Jz+kT8O6qX+i1WLW+DUaTYD33h MKNvBx4SdB72KzEXHsZWaOmodMs3Klo= X-Received: by 2002:a2e:b014:: with SMTP id y20mr3971843ljk.116.1551918559197; Wed, 06 Mar 2019 16:29:19 -0800 (PST) Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com. [209.85.167.47]) by smtp.gmail.com with ESMTPSA id c86sm574578ljf.28.2019.03.06.16.29.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Mar 2019 16:29:18 -0800 (PST) Received: by mail-lf1-f47.google.com with SMTP id u9so6202323lfe.11 for ; Wed, 06 Mar 2019 16:29:18 -0800 (PST) X-Received: by 2002:ac2:5542:: with SMTP id l2mr3446951lfk.136.1551918200185; Wed, 06 Mar 2019 16:23:20 -0800 (PST) MIME-Version: 1.0 References: <20190307000316.31133-1-viro@ZenIV.linux.org.uk> In-Reply-To: <20190307000316.31133-1-viro@ZenIV.linux.org.uk> From: Linus Torvalds Date: Wed, 6 Mar 2019 16:23:04 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/8] aio: make sure file is pinned To: Al Viro Cc: Eric Dumazet , David Miller , Jason Baron , kgraul@linux.ibm.com, ktkhai@virtuozzo.com, kyeongdon kim , Linux List Kernel Mailing , Netdev , pabeni@redhat.com, syzkaller-bugs@googlegroups.com, Cong Wang , Christoph Hellwig , zhengbin , bcrl@kvack.org, linux-fsdevel , linux-aio@kvack.org, houtao1@huawei.com, yi.zhang@huawei.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 6, 2019 at 4:03 PM Al Viro wrote: > > From: Al Viro > > "aio: remove the extra get_file/fput pair in io_submit_one" was > too optimistic - not dereferencing file pointer after e.g. > ->write_iter() returns is not enough; that reference might've been > the only thing that kept alive objects that are referenced > *before* the method returns. Such as inode, for example... I still; think that this is actually _worse_ than just having the refcount on the req instead. As it is, we have that completely insane "ref can go away from under us", because nothing keeps that around, which then causes all those other crazy issues with "woken" etc garbage. I think we should be able to get rid of those entirely. Make the poll() case just return zero if it has added the entry successfully to poll queue. No need for "woken", no need for all that odd "oh, but now the req might no longer exist". The refcount wasn't the problem. Everything *else* was the problem, including only using the refcount for the poll case etc. Linus