[ltt-dev] [PATCH] lttng: Fix list-break bug

Gui Jianfeng guijianfeng at cn.fujitsu.com
Fri Jan 9 04:48:18 EST 2009


Hi Mathieu
When removing ltt-tracer module, OOPS happens.
Because "tmp = ltt_traces.head;" breaks the list.
This patch fix it.

Signed-off-by: Gui Jianfeng <guijianfeng at cn.fujitsu.com>
---
 ltt/ltt-tracer.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/ltt/ltt-tracer.c b/ltt/ltt-tracer.c
index af14135..ceb0c04 100644
--- a/ltt/ltt-tracer.c
+++ b/ltt/ltt-tracer.c
@@ -1159,20 +1159,16 @@ static void __exit ltt_exit(void)
 {
 	struct ltt_trace_struct *trace;
 	struct list_head *pos, *n;
-	struct list_head tmp;
 
 	ltt_lock_traces();
 	/* Stop each trace, currently being read by RCU read-side */
 	list_for_each_entry_rcu(trace, &ltt_traces.head, list)
 		_ltt_trace_stop(trace);
-	tmp = ltt_traces.head;
-	/* empty the original list head */
-	INIT_LIST_HEAD(&ltt_traces.head);
 	/* Wait for quiescent state. Readers have preemption disabled. */
 	synchronize_sched();
 	/* Safe iteration is now permitted. It does not have to be RCU-safe
 	 * because no readers are left. */
-	list_for_each_safe(pos, n, &tmp) {
+	list_for_each_safe(pos, n, &ltt_traces.head) {
 		trace = container_of(pos, struct ltt_trace_struct, list);
 		/* _ltt_trace_destroy does a synchronize_sched() */
 		_ltt_trace_destroy(trace);
-- 
1.5.4.rc3

-- 
Regards
Gui Jianfeng





More information about the lttng-dev mailing list