diff options
author | Al Viro <viro@ZenIV.linux.org.uk> | 2012-08-20 17:59:25 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-02 21:29:54 +0400 |
commit | d156b47c4242843096e4a13f8ace5a0626bde3e9 (patch) | |
tree | 517ce331697fce4a5aadba64df99919e60235c53 /include/linux/perf_event.h | |
parent | 9b52a3b313497af37dcdba4ba4c0c95809db525c (diff) | |
download | linux-d156b47c4242843096e4a13f8ace5a0626bde3e9.tar.xz |
perf_event: Switch to internal refcount, fix race with close()
commit a6fa941d94b411bbd2b6421ffbde6db3c93e65ab upstream.
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>
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r-- | include/linux/perf_event.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index ddbb6a901f65..f18d537fd4ba 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -925,7 +925,7 @@ struct perf_event { struct hw_perf_event hw; struct perf_event_context *ctx; - struct file *filp; + atomic_long_t refcount; /* * These accumulate total time (in nanoseconds) that children |