aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2012-03-14 22:17:39 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2012-04-24 23:54:49 -0400
commit559f9badd11ddf399f88b18b4c0f110fd511ae53 (patch)
tree443f8c575362e19c01c07173c82b0fc3763ebc50 /lib
parent66f75a5d028beaf67c931435fdc3e7823125730c (diff)
rcu: List-debug variants of rcu list routines.
* Make __list_add_rcu check the next->prev and prev->next pointers just like __list_add does. * Make list_del_rcu use __list_del_entry, which does the same checking at deletion time. Has been running for a week here without anything being tripped up, but it seems worth adding for completeness just in case something ever does corrupt those lists. Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/list_debug.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/list_debug.c b/lib/list_debug.c
index 982b850d4e7..3810b481f94 100644
--- a/lib/list_debug.c
+++ b/lib/list_debug.c
@@ -10,6 +10,7 @@
10#include <linux/list.h> 10#include <linux/list.h>
11#include <linux/bug.h> 11#include <linux/bug.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/rculist.h>
13 14
14/* 15/*
15 * Insert a new entry between two known consecutive entries. 16 * Insert a new entry between two known consecutive entries.
@@ -75,3 +76,24 @@ void list_del(struct list_head *entry)
75 entry->prev = LIST_POISON2; 76 entry->prev = LIST_POISON2;
76} 77}
77EXPORT_SYMBOL(list_del); 78EXPORT_SYMBOL(list_del);
79
80/*
81 * RCU variants.
82 */
83void __list_add_rcu(struct list_head *new,
84 struct list_head *prev, struct list_head *next)
85{
86 WARN(next->prev != prev,
87 "list_add_rcu corruption. next->prev should be "
88 "prev (%p), but was %p. (next=%p).\n",
89 prev, next->prev, next);
90 WARN(prev->next != next,
91 "list_add_rcu corruption. prev->next should be "
92 "next (%p), but was %p. (prev=%p).\n",
93 next, prev->next, prev);
94 new->next = next;
95 new->prev = prev;
96 rcu_assign_pointer(list_next_rcu(prev), new);
97 next->prev = new;
98}
99EXPORT_SYMBOL(__list_add_rcu);