diff options
author | Olof Johansson <olof@lixom.net> | 2012-03-13 17:38:09 -0700 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-03-13 17:38:09 -0700 |
commit | ae0b82504e515fdb9bc23c0b770d2b30efd49dc9 (patch) | |
tree | 665d1f26b32f9e68346a9529388fbadec519e865 /fs/aio.c | |
parent | f7c8faedf98aa5ec372e0191078ac7fe1e7fb067 (diff) | |
parent | a6e24019468009a21b674e392d74283a90f415dd (diff) | |
download | linux-ae0b82504e515fdb9bc23c0b770d2b30efd49dc9.tar.bz2 |
Merge branch 'soc' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/renesas into next/soc
* 'soc' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/renesas: (234 commits)
ARM: shmobile: remove additional __io() macro use
ARM: mach-shmobile: default to no earlytimer
ARM: mach-shmobile: r8a7779 and Marzen timer rework
ARM: mach-shmobile: r8a7740 and Bonito timer rework
ARM: mach-shmobile: sh73a0, AG5EVM and Kota2 timer rework
ARM: mach-shmobile: sh7372, AP4EVB and Mackerel timer rework
ARM: mach-shmobile: sh7377 and G4EVM timer rework
ARM: mach-shmobile: sh7367 and G3EVM timer rework
ARM: mach-shmobile: add shmobile_earlytimer_init()
ARM: mach-shmobile: Move sh7372 AP4EVB external clk setup
ARM: mach-shmobile: Move sh7372 Mackerel external clk setup
ARM: mach-shmobile: rename clk_init() to shmobile_clk_init()
ARM: mach-shmobile: r8a7779 L2 cache support
ARM: mach-shmobile: r8a7779 map_io and init_early update
ARM: mach-shmobile: r8a7740 map_io and init_early update
ARM: mach-shmobile: sh73a0 map_io and init_early update
ARM: mach-shmobile: sh7372 map_io and init_early update
ARM: mach-shmobile: sh7377 map_io and init_early update
ARM: mach-shmobile: sh7367 map_io and init_early update
sh: remove clk_ops
...
(includes an update to v3.3-rc7)
Conflicts:
arch/arm/mach-omap2/id.c
Diffstat (limited to 'fs/aio.c')
-rw-r--r-- | fs/aio.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -228,12 +228,6 @@ static void __put_ioctx(struct kioctx *ctx) call_rcu(&ctx->rcu_head, ctx_rcu_free); } -static inline void get_ioctx(struct kioctx *kioctx) -{ - BUG_ON(atomic_read(&kioctx->users) <= 0); - atomic_inc(&kioctx->users); -} - static inline int try_get_ioctx(struct kioctx *kioctx) { return atomic_inc_not_zero(&kioctx->users); @@ -273,7 +267,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) mm = ctx->mm = current->mm; atomic_inc(&mm->mm_count); - atomic_set(&ctx->users, 1); + atomic_set(&ctx->users, 2); spin_lock_init(&ctx->ctx_lock); spin_lock_init(&ctx->ring_info.ring_lock); init_waitqueue_head(&ctx->wait); @@ -490,6 +484,8 @@ static void kiocb_batch_free(struct kioctx *ctx, struct kiocb_batch *batch) kmem_cache_free(kiocb_cachep, req); ctx->reqs_active--; } + if (unlikely(!ctx->reqs_active && ctx->dead)) + wake_up_all(&ctx->wait); spin_unlock_irq(&ctx->ctx_lock); } @@ -607,11 +603,16 @@ static void aio_fput_routine(struct work_struct *data) fput(req->ki_filp); /* Link the iocb into the context's free list */ + rcu_read_lock(); spin_lock_irq(&ctx->ctx_lock); really_put_req(ctx, req); + /* + * at that point ctx might've been killed, but actual + * freeing is RCU'd + */ spin_unlock_irq(&ctx->ctx_lock); + rcu_read_unlock(); - put_ioctx(ctx); spin_lock_irq(&fput_lock); } spin_unlock_irq(&fput_lock); @@ -642,7 +643,6 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req) * this function will be executed w/out any aio kthread wakeup. */ if (unlikely(!fput_atomic(req->ki_filp))) { - get_ioctx(ctx); spin_lock(&fput_lock); list_add(&req->ki_list, &fput_head); spin_unlock(&fput_lock); @@ -1336,10 +1336,10 @@ SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp) ret = PTR_ERR(ioctx); if (!IS_ERR(ioctx)) { ret = put_user(ioctx->user_id, ctxp); - if (!ret) + if (!ret) { + put_ioctx(ioctx); return 0; - - get_ioctx(ioctx); /* io_destroy() expects us to hold a ref */ + } io_destroy(ioctx); } |