X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=fs%2Faio.c;h=6efb7f6cb22e9ba5aabb5f111129ef69b7dac370;hb=6eb5c9db7a362503e6c5ebada6b898409cca4ce1;hp=08159ed13649cacbec1825065e24b2b5b61be267;hpb=ef1e4e32d595d3e6c9a6d3d2956f087d5886c5e5;p=~andy%2Flinux diff --git a/fs/aio.c b/fs/aio.c index 08159ed1364..6efb7f6cb22 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -367,8 +367,10 @@ static int aio_setup_ring(struct kioctx *ctx) if (nr_pages > AIO_RING_PAGES) { ctx->ring_pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL); - if (!ctx->ring_pages) + if (!ctx->ring_pages) { + put_aio_ring_file(ctx); return -ENOMEM; + } } ctx->mmap_size = nr_pages * PAGE_SIZE; @@ -645,7 +647,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) aio_nr + nr_events < aio_nr) { spin_unlock(&aio_nr_lock); err = -EAGAIN; - goto err; + goto err_ctx; } aio_nr += ctx->max_reqs; spin_unlock(&aio_nr_lock); @@ -662,6 +664,8 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) err_cleanup: aio_nr_sub(ctx->max_reqs); +err_ctx: + aio_free_ring(ctx); err: free_percpu(ctx->cpu); free_percpu(ctx->reqs.pcpu_count);