Commit 98fccfd8 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[PKT_SCHED]: Fix rcu_assign_pointer fallout, use it in the right place

The patch 'RCU: use rcu_assign_pointer()'
http://linux.bkbits.net:8080/linux-2.6/diffs/net/sched/sch_api.c@1.39?nav=index.html|src/net/|src/net|src/net/sched|related/net/sched/sch_api.c|cset@1.2287
changed a list_add_tail to list_add_tail_rcu in qdisc_create. It's
dev->qdisc not dev->qdisc_list that is protected by RCU, this patch
reverts that change. It also removes a misleading comment and replaces
the smp_wmb in qdisc_create_dflt by rcu_assign_pointer in dev_activate
to document more clearly what is protected.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent af99de94
...@@ -451,11 +451,9 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp) ...@@ -451,11 +451,9 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp)
else else
sch->handle = handle; sch->handle = handle;
/* enqueue is accessed locklessly - make sure it's visible
* before we set a netdevice's qdisc pointer to sch */
if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS-1])) == 0) { if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS-1])) == 0) {
qdisc_lock_tree(dev); qdisc_lock_tree(dev);
list_add_tail_rcu(&sch->list, &dev->qdisc_list); list_add_tail(&sch->list, &dev->qdisc_list);
qdisc_unlock_tree(dev); qdisc_unlock_tree(dev);
#ifdef CONFIG_NET_ESTIMATOR #ifdef CONFIG_NET_ESTIMATOR
......
...@@ -438,9 +438,6 @@ struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops) ...@@ -438,9 +438,6 @@ struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops)
dev_hold(dev); dev_hold(dev);
sch->stats_lock = &dev->queue_lock; sch->stats_lock = &dev->queue_lock;
atomic_set(&sch->refcnt, 1); atomic_set(&sch->refcnt, 1);
/* enqueue is accessed locklessly - make sure it's visible
* before we set a netdevice's qdisc pointer to sch */
smp_wmb();
if (!ops->init || ops->init(sch, NULL) == 0) if (!ops->init || ops->init(sch, NULL) == 0)
return sch; return sch;
...@@ -521,7 +518,8 @@ void dev_activate(struct net_device *dev) ...@@ -521,7 +518,8 @@ void dev_activate(struct net_device *dev)
} }
spin_lock_bh(&dev->queue_lock); spin_lock_bh(&dev->queue_lock);
if ((dev->qdisc = dev->qdisc_sleeping) != &noqueue_qdisc) { rcu_assign_pointer(dev->qdisc, dev->qdisc_sleeping);
if (dev->qdisc != &noqueue_qdisc) {
dev->trans_start = jiffies; dev->trans_start = jiffies;
dev_watchdog_up(dev); dev_watchdog_up(dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment