On Mon, 2016-06-13 at 09:28 -0700, Cong Wang wrote: > On Sun, Jun 12, 2016 at 10:03 PM, Eric Dumazet <eric.duma...@gmail.com> wrote: > > From: Eric Dumazet <eduma...@google.com> > > > > Now prio_init() can return -ENOMEM, it also has to make sure > > any allocated qdisc are freed, since the caller (qdisc_create()) wont > > call ->destroy() handler for us. > > > But prio_tune() is called by ->change() too, so just call prio_destroy() > inside prio_tune() ?
Because the following should work : tc qdisc replace dev eth0 root prio bands 3 (later...) tc qdisc change dev eth0 root prio bands 5 // memory allocation failure We must not destroy the qdisc on a change operation if it fails. Only the init should clean the qdisc state/memory/children since qdisc wont be created for real. Presumably we should commit changes on qdisc only if the whole ->change() succeeded, but I guess lot of qdisc are buggy in this respect.