Skip to content

Commit

Permalink
Merge branch 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/rric/oprofile into perf/urgent
  • Loading branch information
Ingo Molnar committed Jun 9, 2011
2 parents 5cf42f7 + fe47ae7 commit 5f12713
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
21 changes: 11 additions & 10 deletions drivers/oprofile/buffer_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,20 @@ static struct notifier_block module_load_nb = {
.notifier_call = module_load_notify,
};

static void free_all_tasks(void)
{
/* make sure we don't leak task structs */
process_task_mortuary();
process_task_mortuary();
}

int sync_start(void)
{
int err;

if (!zalloc_cpumask_var(&marked_cpus, GFP_KERNEL))
return -ENOMEM;

mutex_lock(&buffer_mutex);

err = task_handoff_register(&task_free_nb);
if (err)
goto out1;
Expand All @@ -166,14 +171,14 @@ int sync_start(void)
start_cpu_work();

out:
mutex_unlock(&buffer_mutex);
return err;
out4:
profile_event_unregister(PROFILE_MUNMAP, &munmap_nb);
out3:
profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
out2:
task_handoff_unregister(&task_free_nb);
free_all_tasks();
out1:
free_cpumask_var(marked_cpus);
goto out;
Expand All @@ -182,20 +187,16 @@ int sync_start(void)

void sync_stop(void)
{
/* flush buffers */
mutex_lock(&buffer_mutex);
end_cpu_work();
unregister_module_notifier(&module_load_nb);
profile_event_unregister(PROFILE_MUNMAP, &munmap_nb);
profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
task_handoff_unregister(&task_free_nb);
mutex_unlock(&buffer_mutex);
flush_cpu_work();
barrier(); /* do all of the above first */

/* make sure we don't leak task structs */
process_task_mortuary();
process_task_mortuary();
flush_cpu_work();

free_all_tasks();
free_cpumask_var(marked_cpus);
}

Expand Down
3 changes: 3 additions & 0 deletions fs/dcookies.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ SYSCALL_DEFINE(lookup_dcookie)(u64 cookie64, char __user * buf, size_t len)
/* FIXME: (deleted) ? */
path = d_path(&dcs->path, kbuf, PAGE_SIZE);

mutex_unlock(&dcookie_mutex);

if (IS_ERR(path)) {
err = PTR_ERR(path);
goto out_free;
Expand All @@ -194,6 +196,7 @@ SYSCALL_DEFINE(lookup_dcookie)(u64 cookie64, char __user * buf, size_t len)

out_free:
kfree(kbuf);
return err;
out:
mutex_unlock(&dcookie_mutex);
return err;
Expand Down

0 comments on commit 5f12713

Please sign in to comment.