mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 03:06:10 +00:00
Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: tracing/stat: Fix seqfile memory leak function-graph: Fix seqfile memory leak trace_stack: Fix seqfile memory leak profile: Suppress warning about large allocations when profile=1 is specified
This commit is contained in:
commit
b592972493
3 changed files with 36 additions and 20 deletions
|
@ -2595,6 +2595,14 @@ ftrace_graph_open(struct inode *inode, struct file *file)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
ftrace_graph_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
if (file->f_mode & FMODE_READ)
|
||||
seq_release(inode, file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ftrace_set_func(unsigned long *array, int *idx, char *buffer)
|
||||
{
|
||||
|
@ -2724,9 +2732,10 @@ ftrace_graph_write(struct file *file, const char __user *ubuf,
|
|||
}
|
||||
|
||||
static const struct file_operations ftrace_graph_fops = {
|
||||
.open = ftrace_graph_open,
|
||||
.read = seq_read,
|
||||
.write = ftrace_graph_write,
|
||||
.open = ftrace_graph_open,
|
||||
.read = seq_read,
|
||||
.write = ftrace_graph_write,
|
||||
.release = ftrace_graph_release,
|
||||
};
|
||||
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
|
||||
|
||||
|
|
|
@ -301,17 +301,14 @@ static const struct seq_operations stack_trace_seq_ops = {
|
|||
|
||||
static int stack_trace_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = seq_open(file, &stack_trace_seq_ops);
|
||||
|
||||
return ret;
|
||||
return seq_open(file, &stack_trace_seq_ops);
|
||||
}
|
||||
|
||||
static const struct file_operations stack_trace_fops = {
|
||||
.open = stack_trace_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = seq_release,
|
||||
};
|
||||
|
||||
int
|
||||
|
|
|
@ -73,7 +73,7 @@ static struct rb_node *release_next(struct rb_node *node)
|
|||
}
|
||||
}
|
||||
|
||||
static void reset_stat_session(struct stat_session *session)
|
||||
static void __reset_stat_session(struct stat_session *session)
|
||||
{
|
||||
struct rb_node *node = session->stat_root.rb_node;
|
||||
|
||||
|
@ -83,10 +83,17 @@ static void reset_stat_session(struct stat_session *session)
|
|||
session->stat_root = RB_ROOT;
|
||||
}
|
||||
|
||||
static void reset_stat_session(struct stat_session *session)
|
||||
{
|
||||
mutex_lock(&session->stat_mutex);
|
||||
__reset_stat_session(session);
|
||||
mutex_unlock(&session->stat_mutex);
|
||||
}
|
||||
|
||||
static void destroy_session(struct stat_session *session)
|
||||
{
|
||||
debugfs_remove(session->file);
|
||||
reset_stat_session(session);
|
||||
__reset_stat_session(session);
|
||||
mutex_destroy(&session->stat_mutex);
|
||||
kfree(session);
|
||||
}
|
||||
|
@ -150,7 +157,7 @@ static int stat_seq_init(struct stat_session *session)
|
|||
int i;
|
||||
|
||||
mutex_lock(&session->stat_mutex);
|
||||
reset_stat_session(session);
|
||||
__reset_stat_session(session);
|
||||
|
||||
if (!ts->stat_cmp)
|
||||
ts->stat_cmp = dummy_cmp;
|
||||
|
@ -183,7 +190,7 @@ exit:
|
|||
return ret;
|
||||
|
||||
exit_free_rbtree:
|
||||
reset_stat_session(session);
|
||||
__reset_stat_session(session);
|
||||
mutex_unlock(&session->stat_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
@ -250,16 +257,21 @@ static const struct seq_operations trace_stat_seq_ops = {
|
|||
static int tracing_stat_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
int ret;
|
||||
|
||||
struct seq_file *m;
|
||||
struct stat_session *session = inode->i_private;
|
||||
|
||||
ret = stat_seq_init(session);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = seq_open(file, &trace_stat_seq_ops);
|
||||
if (!ret) {
|
||||
struct seq_file *m = file->private_data;
|
||||
m->private = session;
|
||||
ret = stat_seq_init(session);
|
||||
if (ret) {
|
||||
reset_stat_session(session);
|
||||
return ret;
|
||||
}
|
||||
|
||||
m = file->private_data;
|
||||
m->private = session;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -270,11 +282,9 @@ static int tracing_stat_release(struct inode *i, struct file *f)
|
|||
{
|
||||
struct stat_session *session = i->i_private;
|
||||
|
||||
mutex_lock(&session->stat_mutex);
|
||||
reset_stat_session(session);
|
||||
mutex_unlock(&session->stat_mutex);
|
||||
|
||||
return 0;
|
||||
return seq_release(i, f);
|
||||
}
|
||||
|
||||
static const struct file_operations tracing_stat_fops = {
|
||||
|
|
Loading…
Reference in a new issue