From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B1B4C2BB1D for ; Thu, 12 Mar 2020 10:53:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3008620724 for ; Thu, 12 Mar 2020 10:53:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726775AbgCLKxs (ORCPT ); Thu, 12 Mar 2020 06:53:48 -0400 Received: from verein.lst.de ([213.95.11.211]:36273 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725978AbgCLKxs (ORCPT ); Thu, 12 Mar 2020 06:53:48 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 476C168C4E; Thu, 12 Mar 2020 11:53:45 +0100 (CET) Date: Thu, 12 Mar 2020 11:53:45 +0100 From: Christoph Hellwig To: David Howells Cc: Christoph Hellwig , mbobrowski@mbobrowski.org, darrick.wong@oracle.com, jack@suse.cz, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: Is ext4_dio_read_iter() broken? - and xfs_file_dio_aio_read() Message-ID: <20200312105345.GA13559@lst.de> References: <20200312104239.GA13235@lst.de> <969260.1584004779@warthog.procyon.org.uk> <1015227.1584007677@warthog.procyon.org.uk> <1023937.1584010180@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1023937.1584010180@warthog.procyon.org.uk> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, Mar 12, 2020 at 10:49:40AM +0000, David Howells wrote: > Christoph Hellwig wrote: > > > > > at the end of the function - but surely iocb should be expected to have > > > > been freed when iocb->ki_complete() was called? > > > > The iocb is refcounted and only completed when the refcount hits zero, > > and an extra reference is held until the submission has completed. > > Take a look at iocb_put(). > > Ah... This is in struct aio_kiocb and not struct kiocb - that's why I missed > it. Thanks. That being said we have a few other spots using ->ki_complete for asynchronous execution, which might not be as careful. As someone having written one or two of those I have my doubts I got everthing right and will audit those. > > David ---end quoted text---