Subject: Re: [PATCH] PKT_SCHED: Fix double locking in tcindex destroy path

From: Patrick McHardy <[email-masked]>
Date: Fri, 10 Dec 2004 03:35:45 +0100

Thomas Graf wrote:

>tcindex's destroy uses its own delete functions to destroy its
>configuration. The delete function (correctly) takes the qdisc_tree_lock
>to prevent list walkings from happening while removing from the list.
>The qdisc_tree_lock is already held if we're comming via the destroy
>path and thus a double locking takes place.
>
>Patch not needed for 2.4 since both destroy paths are unlocked but will
>be needed if we add them.
>  
>
Looks correct, but 2.4 does need this. qdisc_destroy in 2.4 always
happens under dev->queue_lock. For example dev_shutdown from 2.4:

        write_lock(&qdisc_tree_lock);
        spin_lock_bh(&dev->queue_lock);
...
        qdisc_destroy(qdisc);

But please rename "already_locked" to "lock" to make it look less like
a hack to avoid deadlock.

>+	return __tcindex_delete(tp,arg, 1);
>  
>
And a space is missing :)

Regards
Patrick