[kernel/f14/master] Fix another RCU lockdep warning (cgroups).

Dave Jones davej at fedoraproject.org
Wed Sep 15 20:12:23 UTC 2010


commit 291833d307de6143e4da42d9557356207b881d48
Author: Dave Jones <davej at redhat.com>
Date:   Wed Sep 15 16:12:01 2010 -0400

    Fix another RCU lockdep warning (cgroups).

 kernel.spec                 |    5 ++++
 linux-2.6-cgroups-rcu.patch |   47 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index 2431a5a..d29ba1f 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -729,6 +729,7 @@ Patch12080: kprobes-x86-fix-kprobes-to-skip-prefixes-correctly.patch
 
 # rhbz #622149
 Patch12085: fix-rcu_deref_check-warning.patch
+Patch12086: linux-2.6-cgroups-rcu.patch
 
 # rhbz #513530
 Patch12090: dell-wmi-add-support-for-eject-key-studio-1555.patch
@@ -1366,6 +1367,7 @@ ApplyPatch kprobes-x86-fix-kprobes-to-skip-prefixes-correctly.patch
 
 # bz 622149
 ApplyPatch fix-rcu_deref_check-warning.patch
+ApplyPatch linux-2.6-cgroups-rcu.patch
 
 # bz 513530
 ApplyPatch dell-wmi-add-support-for-eject-key-studio-1555.patch
@@ -1972,6 +1974,9 @@ fi
 # and build.
 
 %changelog
+* Wed Sep 15 2010 Dave Jones <davej at redhat.com>
+- Fix another RCU lockdep warning (cgroups).
+
 * Wed Sep 15 2010 Hans de Goede <hdegoede at redhat.com>
 - virtio_console: Fix poll/select blocking even though there is data to read
 
diff --git a/linux-2.6-cgroups-rcu.patch b/linux-2.6-cgroups-rcu.patch
new file mode 100644
index 0000000..a9a5d99
--- /dev/null
+++ b/linux-2.6-cgroups-rcu.patch
@@ -0,0 +1,47 @@
+Message-ID: <4C805293.1020305 at cn.fujitsu.com>
+Date: 	Fri, 03 Sep 2010 09:42:43 +0800
+From: Li Zefan <lizf at cn.fujitsu.com>
+To: David Miller <davem at davemloft.net>
+CC: Herbert Xu <herbert at gondor.hengli.com.au>, Dave Jones <davej at redhat.com>,
+        netdev <netdev at vger.kernel.org>, LKML <linux-kernel at vger.kernel.org>,
+        Peter Zijlstra <peterz at infradead.org>, Paul Menage <menage at google.com>
+Subject: [PATCH v2] cls_cgroup: Fix rcu lockdep warning
+
+Dave reported an rcu lockdep warning on 2.6.35.4 kernel
+
+task->cgroups and task->cgroups->subsys[i] are protected by RCU.
+So we avoid accessing invalid pointers here. This might happen,
+for example, when you are deref-ing those pointers while someone
+move @task from one cgroup to another.
+
+Reported-by: Dave Jones <davej at redhat.com>
+Signed-off-by: Li Zefan <lizf at cn.fujitsu.com>
+---
+ include/net/cls_cgroup.h |   10 ++++++++--
+ 1 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
+index dd1fdb8..a4dc5b0 100644
+--- a/include/net/cls_cgroup.h
++++ b/include/net/cls_cgroup.h
+@@ -27,11 +27,17 @@ struct cgroup_cls_state
+ #ifdef CONFIG_NET_CLS_CGROUP
+ static inline u32 task_cls_classid(struct task_struct *p)
+ {
++	int classid;
++
+ 	if (in_interrupt())
+ 		return 0;
+ 
+-	return container_of(task_subsys_state(p, net_cls_subsys_id),
+-			    struct cgroup_cls_state, css)->classid;
++	rcu_read_lock();
++	classid = container_of(task_subsys_state(p, net_cls_subsys_id),
++			       struct cgroup_cls_state, css)->classid;
++	rcu_read_unlock();
++
++	return classid;
+ }
+ #else
+ extern int net_cls_subsys_id;
+


More information about the scm-commits mailing list