Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1393763imc; Mon, 11 Mar 2019 12:46:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVkPLeR6+O1yfleNQdTdyG3LRvbJHJr5uCNxRsLoml7dQ62OEOn/FjK7MseDb1haLFkVG/ X-Received: by 2002:aa7:9259:: with SMTP id 25mr34369275pfp.221.1552333603776; Mon, 11 Mar 2019 12:46:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552333603; cv=none; d=google.com; s=arc-20160816; b=TzXl7Sr0iY3yFkWohAoSaB9KKSFn0ib0ZJyu6pTr1rJceIU/ISrMbwsVIPdh8ifkTc g9q92xUCH4Y7AFBglfuY38DD8Rp5SEkbCtb2i6vNAE1UOVx0RqdBE9mvHSQKEH2sLOtr di6r0Vevt4PNYpyjb7TQtA+iQ5cN/i3ntqBpRqTCW3Jntww+I27Ai07mQAw9zJxlE0TX L/jzEujtCFdDmQIEeklL1r3MrwUHK6C6Z4bQNVKLLBH7ot4X5jKE84ls76hzZRTrVq03 p1xSVcUNqlXwxPUTgn5rHamhjJ1/38B12gTW2SRFeV08L1m9kOnTMkCtN78gmOPf4Ciy tiSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=KSC1aum3WMeTd9oDawc3fhedEtOttJo1VuzqETwU6Pw=; b=JgnhlQVq/yDk84UZMRCWhqdUmEGSYcAEvzBF8CMON+ww/H5dU6zuSWdt+wwCDimvGB vOKBVSrjh+WCNF6VMzm6mKJ+jx0WbkueJbbYddpk0jraTr27NTot+auOMfowrjD4Jexd yz0KAbnf0oNP2kYSY4puioTQ5rhbt5z2rhpxQ3QiS7MBxztFaEdrc0WV++FCABlgZ1I7 QT/2ZO10siXA7Mnb+2Q6MmSZ7sm1gZI9AmX8lcvdMJt675tHSMqxaid4m5F35GZLDr8t 3PjH1q1uUX3IKmsHbqiE1MYaLHCFUdOxNqlKss66C/j2wbJfaSi+86jWkY89rItxlTTY FVLA== 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 d24si6196044plr.311.2019.03.11.12.46.27; Mon, 11 Mar 2019 12:46:43 -0700 (PDT) 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 S1728100AbfCKToh (ORCPT + 99 others); Mon, 11 Mar 2019 15:44:37 -0400 Received: from verein.lst.de ([213.95.11.211]:43193 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727008AbfCKTog (ORCPT ); Mon, 11 Mar 2019 15:44:36 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id B9D0C68C7B; Mon, 11 Mar 2019 20:44:31 +0100 (CET) Date: Mon, 11 Mar 2019 20:44:31 +0100 From: Christoph Hellwig To: Al Viro Cc: Linus Torvalds , Eric Dumazet , David Miller , Jason Baron , kgraul@linux.ibm.com, ktkhai@virtuozzo.com, kyeongdon.kim@lge.com, Linux List Kernel Mailing , Netdev , pabeni@redhat.com, syzkaller-bugs@googlegroups.com, xiyou.wangcong@gmail.com, Christoph Hellwig , zhengbin , bcrl@kvack.org, linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, houtao1@huawei.com, yi.zhang@huawei.com Subject: Re: [PATCH 3/8] aio: store event at final iocb_put() Message-ID: <20190311194431.GD12602@lst.de> References: <20190310070606.GA10138@ZenIV.linux.org.uk> <20190310070822.11564-1-viro@ZenIV.linux.org.uk> <20190310070822.11564-3-viro@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190310070822.11564-3-viro@ZenIV.linux.org.uk> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 10, 2019 at 07:08:17AM +0000, Al Viro wrote: > From: Al Viro > > Instead of having aio_complete() set ->ki_res.{res,res2}, do that > explicitly in its callers, drop the reference (as aio_complete() > used to do) and delay the rest until the final iocb_put(). > > Signed-off-by: Al Viro > --- > fs/aio.c | 45 ++++++++++++++++++++------------------------- > 1 file changed, 20 insertions(+), 25 deletions(-) > > diff --git a/fs/aio.c b/fs/aio.c > index 2249a7a1d6b3..b9c4c1894020 100644 > --- a/fs/aio.c > +++ b/fs/aio.c > @@ -1077,24 +1077,10 @@ static inline void iocb_destroy(struct aio_kiocb *iocb) > kmem_cache_free(kiocb_cachep, iocb); > } > > -static inline void iocb_put(struct aio_kiocb *iocb) > -{ > - if (refcount_dec_and_test(&iocb->ki_refcnt)) > - iocb_destroy(iocb); > -} Maybe iocb_put should just have been added in the place you move it to in patch 1?