[ltt-dev] [PATCH 07/10] protect writing to per_cpu_call_rcu_data[*]

Lai Jiangshan laijs at cn.fujitsu.com
Thu Sep 15 01:39:02 EDT 2011


Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
---
 urcu-call-rcu-impl.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/urcu-call-rcu-impl.h b/urcu-call-rcu-impl.h
index 6e80fa9..c822646 100644
--- a/urcu-call-rcu-impl.h
+++ b/urcu-call-rcu-impl.h
@@ -396,12 +396,13 @@ int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp)
 		errno = EINVAL;
 		return -EINVAL;
 	}
-	call_rcu_unlock(&call_rcu_mutex);
 	if (per_cpu_call_rcu_data == NULL) {
+		call_rcu_unlock(&call_rcu_mutex);
 		errno = ENOMEM;
 		return -ENOMEM;
 	}
 	per_cpu_call_rcu_data[cpu] = crdp;
+	call_rcu_unlock(&call_rcu_mutex);
 	return 0;
 }
 
-- 
1.7.4.4





More information about the lttng-dev mailing list