]> git.baikalelectronics.ru Git - kernel.git/commit
perf_event: Switch to internal refcount, fix race with close()
authorAl Viro <viro@ZenIV.linux.org.uk>
Mon, 20 Aug 2012 13:59:25 +0000 (14:59 +0100)
committerIngo Molnar <mingo@kernel.org>
Tue, 4 Sep 2012 15:29:22 +0000 (17:29 +0200)
commit7985600ca39dbb8d4a7e2db74d28f525cf6425e4
tree2d80af531f906c6b27184148bbf15b8a7469c2a7
parentb3e2543491dc2705d6dc0d6edcdabbd8e2ec6fdc
perf_event: Switch to internal refcount, fix race with close()

Don't mess with file refcounts (or keep a reference to file, for
that matter) in perf_event.  Use explicit refcount of its own
instead.  Deal with the race between the final reference to event
going away and new children getting created for it by use of
atomic_long_inc_not_zero() in inherit_event(); just have the
latter free what it had allocated and return NULL, that works
out just fine (children of siblings of something doomed are
created as singletons, same as if the child of leader had been
created and immediately killed).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: stable@kernel.org
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20120820135925.GG23464@ZenIV.linux.org.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/perf_event.h
kernel/events/core.c