]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
aio-kill-ki_retry-fix-fix
authorKent Overstreet <koverstreet@google.com>
Sun, 10 Mar 2013 10:55:44 +0000 (21:55 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 12 Mar 2013 03:57:45 +0000 (14:57 +1100)
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>
fs/aio.c

index 45c300856dde08a1395b24b4336daf14d6808b00..249ae83230bde65b74b3d8e9fe08aaf6cfaf59f6 100644 (file)
--- 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;
 }