tracing: fix event_subsystem ref counting
PATCH 1/1 tracing: fix event_subsystem ref counting
Fix a bug introduced by e9dbfae5, which prevents event_subsystem from ever being released.
Ref_count was added to keep track of subsystem users, not for counting events. Subsystem is created with ref_count = 1, so there is no need to increment it for every event, we have nr_events for that. Fix this by touching ref_count only when we actually have a new user - subsystem_open().
--- kernel/trace/trace_events.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
kernel/trace/trace_events.c +0 -1
@@ -1078,7 +1078,6 @@ event_subsystem_dir(const char *name, struct dentry *d_events)/* First see if we did not already create this dir */ list_for_each_entry (system, &event_subsystems, list) {if (strcmp (system->name, name) ==0 ) { -__get_system (system); system->nr_events++;return system->entry; }
Signature · 1 line
1.7.6.3
Steven Rostedt
maintainerQuoted 8 lines · Ilya Dryomov
Fix a bug introduced by
e9dbfae5, which preventsevent_subsystemfrom ever being released.
Ref_countwas added to keep track of subsystem users, not for counting events. Subsystem is created withref_count= 1, so there is no need to increment it for every event, we havenr_eventsfor that. Fix this by touchingref_countonly when we actually have a new user -subsystem_open().
Good catch, I'll pull this in.
Thanks!
-- Steve
Quoted 18 lines
Signed-off-by Ilya Dryomov <[email protected]>--- kernel/trace/trace_events.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)kernel/trace/trace_events.c +0
-1@@ -1078,7 +1078,6 @@ event_subsystem_dir(const char *name, struct dentry *d_events)/* First see if we did not already create this dir */ list_for_each_entry (system, &event_subsystems, list) {if (strcmp (system->name, name) ==0 ) { -__get_system (system); system->nr_events++;return system->entry; }
Quoted 4 lines · Steven Rostedt
Quoted 3 lines · Ilya Dryomov
Fix a bug introduced by
e9dbfae5, which preventsevent_subsystemfrom ever being released.
Quoted 8 lines
Quoted 5 lines
Ref_countwas added to keep track of subsystem users, not for counting events. Subsystem is created withref_count= 1, so there is no need to increment it for every event, we havenr_eventsfor that. Fix this by touchingref_countonly when we actually have a new user -subsystem_open().Good catch, I'll pull this in.
I made a different fix last week:
http://marc.info/?l=linux-kernel&m=131978486911595&w=2
but I guess Ilya's version is a bit better.
Steven Rostedt
maintainerQuoted 11 lines · Li Zefan
Quoted 10 lines · Steven Rostedt
Quoted 8 lines · Ilya Dryomov
Fix a bug introduced by
e9dbfae5, which preventsevent_subsystemfrom ever being released.
Ref_countwas added to keep track of subsystem users, not for counting events. Subsystem is created withref_count= 1, so there is no need to increment it for every event, we havenr_eventsfor that. Fix this by touchingref_countonly when we actually have a new user -subsystem_open().
Quoted 8 lines
Quoted 2 lines
Good catch, I'll pull this in.
I made a different fix last week:
http://marc.info/?l=linux-kernel&m=131978486911595&w=2
but I guess Ilya's version is a bit better.
That patch was still in my queue to process, as I missed it during my travels to Prague. But yeah, I think Ilya's patch is a better solution.
Thanks!
-- Steve
Commit-ID: d631097577f6fe027f4903f62eabced6445d19bf Gitweb: http://git.kernel.org/tip/d631097577f6fe027f4903f62eabced6445d19bf Author: Ilya Dryomov <[email protected]> AuthorDate: Mon, 31 Oct 2011 11:07:42 +0200 Committer: Steven Rostedt <[email protected]> CommitDate: Mon, 31 Oct 2011 13:59:23 -0400
tracing: fix event_subsystem ref counting
Fix a bug introduced by e9dbfae5, which prevents event_subsystem from ever being released.
Ref_count was added to keep track of subsystem users, not for counting events. Subsystem is created with ref_count = 1, so there is no need to increment it for every event, we have nr_events for that. Fix this by touching ref_count only when we actually have a new user - subsystem_open().
--- kernel/trace/trace_events.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
kernel/trace/trace_events.c +0 -1
@@ -1078,7 +1078,6 @@ event_subsystem_dir(const char *name, struct dentry *d_events)/* First see if we did not already create this dir */ list_for_each_entry (system, &event_subsystems, list) {if (strcmp (system->name, name) ==0 ) { -__get_system (system); system->nr_events++;return system->entry; }
Commit-ID: cb59974742aea24adf6637eb0c4b8e7b48bca6fb Gitweb: http://git.kernel.org/tip/cb59974742aea24adf6637eb0c4b8e7b48bca6fb Author: Ilya Dryomov <[email protected]> AuthorDate: Mon, 31 Oct 2011 11:07:42 +0200 Committer: Steven Rostedt <[email protected]> CommitDate: Mon, 5 Dec 2011 13:28:44 -0500
tracing: fix event_subsystem ref counting
Fix a bug introduced by e9dbfae5, which prevents event_subsystem from ever being released.
Ref_count was added to keep track of subsystem users, not for counting events. Subsystem is created with ref_count = 1, so there is no need to increment it for every event, we have nr_events for that. Fix this by touching ref_count only when we actually have a new user - subsystem_open().
--- kernel/trace/trace_events.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
kernel/trace/trace_events.c +0 -1
@@ -1078,7 +1078,6 @@ event_subsystem_dir(const char *name, struct dentry *d_events)/* First see if we did not already create this dir */ list_for_each_entry (system, &event_subsystems, list) {if (strcmp (system->name, name) ==0 ) { -__get_system (system); system->nr_events++;return system->entry; }