summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-03 08:27:37 +0200
committerDavid S. Miller <davem@davemloft.net>2008-08-03 08:27:37 +0200
commit7e43f1128d4c4bd91786ca6abff45a91e88f9776 (patch)
tree9bf24079d6a70090d1872b23b95c483237d86b25 /include/net
parentmac80211: Use queue_lock() in ieee80211_ht_agg_queue_remove(). (diff)
downloadlinux-7e43f1128d4c4bd91786ca6abff45a91e88f9776.tar.xz
linux-7e43f1128d4c4bd91786ca6abff45a91e88f9776.zip
pkt_sched: Make sure RTNL is held in qdisc_root_lock().
It is the only legal environment in which this can be used. Add some commentary explaining the situation. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/sch_generic.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index b5f40d7ef724..c5bb13065051 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -193,10 +193,22 @@ static inline struct Qdisc *qdisc_root(struct Qdisc *qdisc)
return qdisc->dev_queue->qdisc;
}
+/* The qdisc root lock is a mechanism by which to top level
+ * of a qdisc tree can be locked from any qdisc node in the
+ * forest. This allows changing the configuration of some
+ * aspect of the qdisc tree while blocking out asynchronous
+ * qdisc access in the packet processing paths.
+ *
+ * It is only legal to do this when the root will not change
+ * on us. Otherwise we'll potentially lock the wrong qdisc
+ * root. This is enforced by holding the RTNL semaphore, which
+ * all users of this lock accessor must do.
+ */
static inline spinlock_t *qdisc_root_lock(struct Qdisc *qdisc)
{
struct Qdisc *root = qdisc_root(qdisc);
+ ASSERT_RTNL();
return qdisc_lock(root);
}