From cfdc1b7046bc9e5f937c01255bef83464cbdc1e6 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Wed, 20 Feb 2013 13:16:54 +1100 Subject: aio-kill-ki_retry-fix-fix The "aio: kill ki-retry" patch was assuming that we didn't touch struct kiocb after passing it off to something that would call aio_complete() - which was wrong. So, revert the refcounting changes. Signed-off-by: Kent Overstreet Signed-off-by: Andrew Morton --- fs/aio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 3c853009f92e..5b9686b139db 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -587,7 +587,7 @@ static inline struct kiocb *aio_get_req(struct kioctx *ctx) if (unlikely(!req)) goto out_put; - atomic_set(&req->ki_users, 1); + atomic_set(&req->ki_users, 2); req->ki_ctx = ctx; return req; out_put: @@ -1182,10 +1182,12 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, if (ret) goto out_put_req; + aio_put_req(req); /* drop extra ref to req */ return 0; out_put_req: put_reqs_available(ctx, 1); - aio_put_req(req); + aio_put_req(req); /* drop extra ref to req */ + aio_put_req(req); /* drop i/o ref to req */ return ret; } -- cgit v1.2.3