From 325eea11226738c37c6b6fd2a12dd0c867a18f08 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Mon, 13 Jun 2011 11:59:42 +0200 Subject: [PATCH] --- yaml --- r: 253795 b: refs/heads/master c: afbee42706090fa59dac299c9607e4fd4361ec82 h: refs/heads/master i: 253793: 3767548070f23957ca81ca70ef8bf7da6afba417 253791: b83a1e2134fe7f86b07789b9ff51457875bb32f3 v: v3 --- [refs] | 2 +- trunk/drivers/oprofile/buffer_sync.c | 21 +++++++++++---------- trunk/fs/dcookies.c | 3 +++ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/[refs] b/[refs] index 57c3f6add03d..7cac98f7f320 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: db5e7ecc4abc91b9f26f0c0d79ef88a51e987d90 +refs/heads/master: afbee42706090fa59dac299c9607e4fd4361ec82 diff --git a/trunk/drivers/oprofile/buffer_sync.c b/trunk/drivers/oprofile/buffer_sync.c index a3984f4ef192..f34b5b29fb95 100644 --- a/trunk/drivers/oprofile/buffer_sync.c +++ b/trunk/drivers/oprofile/buffer_sync.c @@ -141,6 +141,13 @@ 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; @@ -148,8 +155,6 @@ int sync_start(void) 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; @@ -166,7 +171,6 @@ int sync_start(void) start_cpu_work(); out: - mutex_unlock(&buffer_mutex); return err; out4: profile_event_unregister(PROFILE_MUNMAP, &munmap_nb); @@ -174,6 +178,7 @@ int sync_start(void) 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; @@ -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); } diff --git a/trunk/fs/dcookies.c b/trunk/fs/dcookies.c index a21cabdbd87b..dda0dc702d1b 100644 --- a/trunk/fs/dcookies.c +++ b/trunk/fs/dcookies.c @@ -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; @@ -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;