]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
qdisc: catch misconfig of attaching qdisc to tx_queue_len zero device
authorJesper Dangaard Brouer <brouer@redhat.com>
Thu, 3 Nov 2016 13:56:11 +0000 (14:56 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Nov 2016 01:15:55 +0000 (20:15 -0500)
commit84c46dd865384a1613e797b967552e4a428b5202
treefd0201d39d33a237267cf9c0ca62166e3b246469
parent1159708432f7067b82388695e29d7105e79bd293
qdisc: catch misconfig of attaching qdisc to tx_queue_len zero device

It is a clear misconfiguration to attach a qdisc to a device with
tx_queue_len zero, because some qdisc's (namely, pfifo, bfifo, gred,
htb, plug and sfb) inherit/copy this value as their queue length.

Why should the kernel catch such a misconfiguration?  Because prior to
introducing the IFF_NO_QUEUE device flag, userspace found a loophole
in the qdisc config system that allowed them to achieve the equivalent
of IFF_NO_QUEUE, which is to remove the qdisc code path entirely from
a device.  The loophole on older kernels is setting tx_queue_len=0,
*prior* to device qdisc init (the config time is significant, simply
setting tx_queue_len=0 doesn't trigger the loophole).

This loophole is currently used by Docker[1] to get better performance
and scalability out of the veth device.  The Docker developers were
warned[1] that they needed to adjust the tx_queue_len if ever
attaching a qdisc.  The OpenShift project didn't remember this warning
and attached a qdisc, this were caught and fixed in[2].

[1] https://github.com/docker/libcontainer/pull/193
[2] https://github.com/openshift/origin/pull/11126

Instead of fixing every userspace program that used this loophole, and
forgot to reset the tx_queue_len, prior to attaching a qdisc.  Let's
catch the misconfiguration on the kernel side.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_api.c