Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755394Ab3DLQvw (ORCPT ); Fri, 12 Apr 2013 12:51:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30244 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751183Ab3DLQvv (ORCPT ); Fri, 12 Apr 2013 12:51:51 -0400 From: Jeff Moyer To: Kent Overstreet Cc: linux-kernel@vger.kernel.org, linux-aio@kvack.org, akpm@linux-foundation.org, Zach Brown , Felipe Balbi , Greg Kroah-Hartman , Mark Fasheh , Joel Becker , Rusty Russell , Jens Axboe , Asai Thambi S P , Selvan Mani , Sam Bradshaw , Al Viro , Benjamin LaHaise , "Theodore Ts'o" Subject: Re: [PATCH 10/33] aio: do fget() after aio_get_req() References: <1363883754-27966-1-git-send-email-koverstreet@google.com> <1363883754-27966-11-git-send-email-koverstreet@google.com> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 X-PCLoadLetter: What the f**k does that mean? Date: Fri, 12 Apr 2013 12:51:23 -0400 In-Reply-To: <1363883754-27966-11-git-send-email-koverstreet@google.com> (Kent Overstreet's message of "Thu, 21 Mar 2013 09:35:31 -0700") Message-ID: User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1421 Lines: 41 Kent Overstreet writes: > aio_get_req() will fail if we have the maximum number of requests > outstanding, which depending on the application may not be uncommon. So > avoid doing an unnecessary fget(). > diff --git a/fs/aio.c b/fs/aio.c > index 2637555..4f23d43 100644 > --- a/fs/aio.c > +++ b/fs/aio.c > @@ -587,6 +587,8 @@ static inline void really_put_req(struct kioctx *ctx, struct kiocb *req) > { > assert_spin_locked(&ctx->ctx_lock); > > + if (req->ki_filp) > + fput(req->ki_filp); > if (req->ki_eventfd != NULL) > eventfd_ctx_put(req->ki_eventfd); > if (req->ki_dtor) [snip] > @@ -618,8 +617,6 @@ static void __aio_put_req(struct kioctx *ctx, struct kiocb *req) > req->ki_cancel = NULL; > req->ki_retry = NULL; > > - fput(req->ki_filp); > - req->ki_filp = NULL; > really_put_req(ctx, req); > } So you've removed the setting of req->ki_filp to NULL here, and I think it's okay. The only function called after that which could possibly be tripped up is req->ki_dtor. That function has no business looking at ki_filp, I think (and the only in-tree user does not look at it). Acked-by: Jeff Moyer -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/