lkml.org 
[lkml]   [2013]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 10/33] aio: do fget() after aio_get_req()
Date
Kent Overstreet <koverstreet@google.com> 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 <jmoyer@redhat.com>


\
 
 \ /
  Last update: 2013-04-12 19:41    [W:1.743 / U:0.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site