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>
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:
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;
}