Skip to content

Commit

Permalink
aio: don't bother with async freeing on failure in ioctx_alloc()
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Mar 21, 2012
1 parent 5d026c7 commit e23754f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions fs/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
struct mm_struct *mm;
struct kioctx *ctx;
int did_sync = 0;
int err = -ENOMEM;

/* Prevent overflows */
if ((nr_events > (0x10000000U / sizeof(struct io_event))) ||
Expand Down Expand Up @@ -310,16 +311,13 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
return ctx;

out_cleanup:
__put_ioctx(ctx);
return ERR_PTR(-EAGAIN);

err = -EAGAIN;
aio_free_ring(ctx);
out_freectx:
mmdrop(mm);
kmem_cache_free(kioctx_cachep, ctx);
ctx = ERR_PTR(-ENOMEM);

dprintk("aio: error allocating ioctx %p\n", ctx);
return ctx;
dprintk("aio: error allocating ioctx %d\n", err);
return ERR_PTR(err);
}

/* aio_cancel_all
Expand Down

0 comments on commit e23754f

Please sign in to comment.