pkt_sched: Use per-queue locking in shutdown_scheduler_queue.
authorDavid S. Miller <davem@davemloft.net>
Wed, 16 Jul 2008 09:36:04 +0000 (02:36 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Jul 2008 02:21:23 +0000 (19:21 -0700)
This eliminates another qdisc_lock_tree user.

Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_generic.c

index 082db8a..efa418a 100644 (file)
@@ -757,18 +757,20 @@ static void shutdown_scheduler_queue(struct net_device *dev,
        struct Qdisc *qdisc_default = _qdisc_default;
 
        if (qdisc) {
+               spinlock_t *root_lock = qdisc_root_lock(qdisc);
+
                dev_queue->qdisc = qdisc_default;
                dev_queue->qdisc_sleeping = qdisc_default;
 
+               spin_lock(root_lock);
                qdisc_destroy(qdisc);
+               spin_unlock(root_lock);
        }
 }
 
 void dev_shutdown(struct net_device *dev)
 {
-       qdisc_lock_tree(dev);
        netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc);
        shutdown_scheduler_queue(dev, &dev->rx_queue, NULL);
        BUG_TRAP(!timer_pending(&dev->watchdog_timer));
-       qdisc_unlock_tree(dev);
 }