public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>,
	netdev@vger.kernel.org, davem@davemloft.net,
	Wang Bo <wang.bo116@zte.com.cn>,
	John Fastabend <john.r.fastabend@intel.com>,
	Eric Dumazet <edumazet@google.com>, Terry Lam <vtlam@google.com>
Subject: Re: [Patch net 2/2] net_sched: always call ->destroy when ->init() fails
Date: Sat, 25 Oct 2014 01:36:45 +0100	[thread overview]
Message-ID: <20141025003644.GB11289@acer.localdomain> (raw)
In-Reply-To: <1414196053.20845.45.camel@edumazet-glaptop2.roam.corp.google.com>

On Fri, Oct 24, 2014 at 05:14:13PM -0700, Eric Dumazet wrote:
> On Fri, 2014-10-24 at 16:55 -0700, Cong Wang wrote:
> > In qdisc_create(), when ->init() exists and it fails, we should
> > call ->destroy() to clean up the potentially partially initialized
> > qdisc's. This will also make the ->init() implementation easier.
> > 
> 
> Why is this patch needed ?
> 
> You are adding bugs, its not clear what bug you are fixing.
> 
> I really do not like the idea of ->init() relying on a ->destroy() to
> cleanup a failed ->init().
> 
> This is not what most management functions do in our stack.
> 
> I very much prefer that a function returning an error has no side
> effect, like if it hadnt be called at all.

Absolutely.

Again, the correct fix is to make qdisc_create_dflt() not call
qdisc_destroy() but clean up the qdisc manually as done in
qdisc_create().

  parent reply	other threads:[~2014-10-25  0:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-24 23:55 [Patch net 1/2] sch_pie: schedule the timer after all init succeed Cong Wang
2014-10-24 23:55 ` [Patch net 2/2] net_sched: always call ->destroy when ->init() fails Cong Wang
2014-10-25  0:14   ` Eric Dumazet
2014-10-25  0:36     ` Cong Wang
2014-10-25  0:40       ` Eric Dumazet
2014-10-25  0:42       ` Eric Dumazet
2014-10-25  0:36     ` Patrick McHardy [this message]
2014-10-25  0:38       ` Cong Wang
2014-10-25  0:44         ` Patrick McHardy
2014-10-25  0:53           ` Cong Wang
2014-10-25  1:04             ` Patrick McHardy
2014-10-28 19:58               ` David Miller
2014-10-29 18:29   ` David Miller
2014-10-30  3:09     ` John Fastabend
2014-10-25  0:17 ` [Patch net 1/2] sch_pie: schedule the timer after all init succeed Eric Dumazet
2014-10-25  0:28   ` Cong Wang
2014-10-25  0:39     ` Eric Dumazet
2014-10-25  0:42       ` Cong Wang
2014-10-29 18:28 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141025003644.GB11289@acer.localdomain \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=john.r.fastabend@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=vtlam@google.com \
    --cc=wang.bo116@zte.com.cn \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox