Kent Overstreet <[email protected]> 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 <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to