Commit e23754f8 authored by Al Viro's avatar Al Viro

aio: don't bother with async freeing on failure in ioctx_alloc()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 5d026c72
...@@ -248,6 +248,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) ...@@ -248,6 +248,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
struct mm_struct *mm; struct mm_struct *mm;
struct kioctx *ctx; struct kioctx *ctx;
int did_sync = 0; int did_sync = 0;
int err = -ENOMEM;
/* Prevent overflows */ /* Prevent overflows */
if ((nr_events > (0x10000000U / sizeof(struct io_event))) || if ((nr_events > (0x10000000U / sizeof(struct io_event))) ||
...@@ -310,16 +311,13 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) ...@@ -310,16 +311,13 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
return ctx; return ctx;
out_cleanup: out_cleanup:
__put_ioctx(ctx); err = -EAGAIN;
return ERR_PTR(-EAGAIN); aio_free_ring(ctx);
out_freectx: out_freectx:
mmdrop(mm); mmdrop(mm);
kmem_cache_free(kioctx_cachep, ctx); kmem_cache_free(kioctx_cachep, ctx);
ctx = ERR_PTR(-ENOMEM); dprintk("aio: error allocating ioctx %d\n", err);
return ERR_PTR(err);
dprintk("aio: error allocating ioctx %p\n", ctx);
return ctx;
} }
/* aio_cancel_all /* aio_cancel_all
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment