lkml.org 
[lkml]   [2014]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/6] percpu-refcount, aio: use percpu_ref_cancel_init() in ioctx_alloc()
On Tue, Jun 17, 2014 at 09:08:00PM -0400, Tejun Heo wrote:
> ioctx_alloc() reaches inside percpu_ref and directly frees
> ->pcpu_count in its failure path, which is quite gross. percpu_ref
> has been providing a proper interface to do this,
> percpu_ref_cancel_init(), for quite some time now. Let's use that
> instead.

I applied this to my aio-next tree at git://git.kvack.org/~bcrl/aio-next.git .

-ben

> This patch doesn't introduce any behavior changes.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Benjamin LaHaise <bcrl@kvack.org>
> Cc: Kent Overstreet <kmo@daterainc.com>
> ---
> fs/aio.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 4f078c0..5e0d7f9 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -715,8 +715,8 @@ err_ctx:
> err:
> mutex_unlock(&ctx->ring_lock);
> free_percpu(ctx->cpu);
> - free_percpu(ctx->reqs.pcpu_count);
> - free_percpu(ctx->users.pcpu_count);
> + percpu_ref_cancel_init(&ctx->reqs);
> + percpu_ref_cancel_init(&ctx->users);
> kmem_cache_free(kioctx_cachep, ctx);
> pr_debug("error allocating ioctx %d\n", err);
> return ERR_PTR(err);
> --
> 1.9.3

--
"Thought is the essence of where you are now."


\
 
 \ /
  Last update: 2014-06-25 18:21    [W:1.773 / U:0.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site