netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Lorenzo Colitti <lorenzo@google.com>
Cc: "David Ahern" <dsahern@gmail.com>,
	"David Miller" <davem@davemloft.net>,
	"Yaro Slav" <yaro330@gmail.com>,
	"Thomas Haller" <thaller@redhat.com>,
	"Alistair Strachan" <astrachan@google.com>,
	"Greg KH" <greg@kroah.com>,
	"Linux NetDev" <netdev@vger.kernel.org>,
	"David Ahern" <dsa@cumulusnetworks.com>,
	"Maciej Żenczykowski" <zenczykowski@gmail.com>
Subject: Re: [PATCH net] fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied
Date: Wed, 5 Jun 2019 12:05:49 +0800	[thread overview]
Message-ID: <20190605040549.GB18865@dhcp-12-139.nay.redhat.com> (raw)
In-Reply-To: <CAKD1Yr2a_GfRYyrotzb2j-hLdWjzDEU3fbwtTrLiU090R55h-g@mail.gmail.com>

On Wed, Jun 05, 2019 at 12:43:44PM +0900, Lorenzo Colitti wrote:
> On Wed, Jun 5, 2019 at 12:29 PM Hangbin Liu <liuhangbin@gmail.com> wrote:
> > > We rely on being able to add a rule and either have a dup be created
> > > (in which case we'll remove it later) or have it fail with EEXIST (in
> > > which case we won't remove it later).
> >
> > With Maciej said, how about add NLM_F_EXCL flag when you add a new rule.
> > If it returned EEXIST, which means there is an dup rule, you just do not
> > remove it later.
> >
> > Would that fix your issue?
> 
> We can't do that without rewriting our code and making it more
> complex. The way the code is structured is that an update is "add all
> new rules; delete all old rules". To do what you suggest we would need
> to either change that to "for rule in rules; add newrule; delete
> oldrule" or we'd need to keep state on which rules already existed.

Hmm...Generally speaking we need to check the cmd's return value, or why it
exists.

> 
> The previous behaviour provided semantics that are useful to
> userspace, and this commit broke those semantics. Please revert.

Keep two exactally same rules in kernel looks strange and doesn't make
sense to me. But let's see what does David Ahern think, he is more
experienced in this part :)

Thanks
Hangbin

  reply	other threads:[~2019-06-05  4:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-07  9:11 [PATCH net] fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied Hangbin Liu
2019-05-08 16:35 ` David Miller
2019-06-01  1:43   ` Maciej Żenczykowski
2019-06-01  9:32     ` Greg KH
2019-06-05  1:43     ` Hangbin Liu
2019-06-05  1:47       ` Lorenzo Colitti
2019-06-05  2:15         ` Hangbin Liu
2019-06-05  2:25           ` Lorenzo Colitti
2019-06-05  3:29             ` Hangbin Liu
2019-06-05  3:43               ` Lorenzo Colitti
2019-06-05  4:05                 ` Hangbin Liu [this message]
2019-06-05  3:57       ` David Ahern
2019-06-05  4:08         ` Hangbin Liu
2019-06-05  4:58         ` Lorenzo Colitti
2019-06-05 15:33           ` David Ahern
2019-06-06 23:01             ` Maciej Żenczykowski

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=20190605040549.GB18865@dhcp-12-139.nay.redhat.com \
    --to=liuhangbin@gmail.com \
    --cc=astrachan@google.com \
    --cc=davem@davemloft.net \
    --cc=dsa@cumulusnetworks.com \
    --cc=dsahern@gmail.com \
    --cc=greg@kroah.com \
    --cc=lorenzo@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=thaller@redhat.com \
    --cc=yaro330@gmail.com \
    --cc=zenczykowski@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;
as well as URLs for NNTP newsgroup(s).