| From | Jeff Moyer <> | Subject | Re: [PATCH 10/33] aio: do fget() after aio_get_req() | Date | Fri, 12 Apr 2013 12:51:23 -0400 |
| |
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>
|