summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2013-02-20 13:16:54 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2013-03-01 15:17:32 +1100
commitcfdc1b7046bc9e5f937c01255bef83464cbdc1e6 (patch)
treefa3a75beb14600b30622e5cf8e48ee353a5be327
parenta1e520ba6a023f257b37b4860aac1485ba138d59 (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 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;
}