summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2013-02-07 12:32:13 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2013-02-07 16:39:56 +1100
commit2f8b92e946bfdfae6a50e7036c81c0ac3718c0d3 (patch)
tree55322352b001ea4a91837ae02b907886b04598fe
parent7fc04386707ce1cfc7582a8773f97d5ef9afd028 (diff)
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 <koverstreet@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--fs/aio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/aio.c b/fs/aio.c
index bcdf7cdd877a..3d8d70b16cb0 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:
@@ -1183,10 +1183,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;
}