aio: use iocb_put() instead of open coding it
authorJens Axboe <axboe@kernel.dk>
Sun, 25 Nov 2018 04:33:09 +0000 (21:33 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 May 2019 07:58:58 +0000 (09:58 +0200)
commit 71ebc6fef0f53459f37fb39e1466792232fa52ee upstream.

Replace the percpu_ref_put() + kmem_cache_free() with a call to
iocb_put() instead.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/aio.c

index 2547f17..e2b63ab 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1886,10 +1886,9 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
                goto out_put_req;
        return 0;
 out_put_req:
-       percpu_ref_put(&ctx->reqs);
        if (req->ki_eventfd)
                eventfd_ctx_put(req->ki_eventfd);
-       kmem_cache_free(kiocb_cachep, req);
+       iocb_put(req);
 out_put_reqs_available:
        put_reqs_available(ctx, 1);
        return ret;