aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sch_generic.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-03 02:27:37 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-03 02:27:37 -0400
commit7e43f1128d4c4bd91786ca6abff45a91e88f9776 (patch)
tree9bf24079d6a70090d1872b23b95c483237d86b25 /include/net/sch_generic.h
parent35ed4e75989c4e84a44b25569bbf09b98f923880 (diff)
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/sch_generic.h')
-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)
193 return qdisc->dev_queue->qdisc; 193 return qdisc->dev_queue->qdisc;
194} 194}
195 195
196/* The qdisc root lock is a mechanism by which to top level
197 * of a qdisc tree can be locked from any qdisc node in the
198 * forest. This allows changing the configuration of some
199 * aspect of the qdisc tree while blocking out asynchronous
200 * qdisc access in the packet processing paths.
201 *
202 * It is only legal to do this when the root will not change
203 * on us. Otherwise we'll potentially lock the wrong qdisc
204 * root. This is enforced by holding the RTNL semaphore, which
205 * all users of this lock accessor must do.
206 */
196static inline spinlock_t *qdisc_root_lock(struct Qdisc *qdisc) 207static inline spinlock_t *qdisc_root_lock(struct Qdisc *qdisc)
197{ 208{
198 struct Qdisc *root = qdisc_root(qdisc); 209 struct Qdisc *root = qdisc_root(qdisc);
199 210
211 ASSERT_RTNL();
200 return qdisc_lock(root); 212 return qdisc_lock(root);
201} 213}
202 214