Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: Pravin Shelar <pshelar@ovn.org>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	ovs dev <dev@openvswitch.org>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next v2 2/3] net: openvswitch: refactor flow free function
Date: Mon, 24 Aug 2020 21:56:42 +0800	[thread overview]
Message-ID: <CAMDZJNVzkbuc2Wx0dOd_JFEiNG+D9FFm0+PFrs2CFU7-x=F5kg@mail.gmail.com> (raw)
In-Reply-To: <20200824.060926.429831991235819793.davem@davemloft.net>

On Mon, Aug 24, 2020 at 9:09 PM David Miller <davem@davemloft.net> wrote:
>
> From: xiangxia.m.yue@gmail.com
> Date: Mon, 24 Aug 2020 15:36:01 +0800
>
> > To avoid a bug when deleting flows in the future, add
> > BUG_ON in flush flows function.
>
> BUG_ON() is too severe, I think WARN_ON() or similar are sufficient
> because the kernel can try to continue operating if this condition is
> detected.
>
> And you can force the values to zero in such a situation.
Thanks, David
will be changed to:

diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c
index 0473758035b5..5378282e1d13 100644
--- a/net/openvswitch/flow_table.c
+++ b/net/openvswitch/flow_table.c
@@ -492,8 +492,11 @@ void table_instance_flow_flush(struct flow_table *table,
                }
        }

-       BUG_ON(table->count != 0);
-       BUG_ON(table->ufid_count != 0);
+       if (WARN_ON(table->count != 0 ||
+                   table->ufid_count != 0)) {
+               table->count = 0;
+               table->ufid_count = 0
+       }
 }

> Thank you.



-- 
Best regards, Tonghao

  reply	other threads:[~2020-08-24 13:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24  7:35 [PATCH net-next v2 0/3] net: openvswitch: improve codes xiangxia.m.yue
2020-08-24  7:36 ` [PATCH net-next v2 1/3] net: openvswitch: improve coding style xiangxia.m.yue
2020-08-26 19:23   ` Pravin Shelar
2020-08-31 13:00     ` Tonghao Zhang
2020-08-31 18:41       ` David Miller
2020-09-01 12:32         ` Tonghao Zhang
2020-08-24  7:36 ` [PATCH net-next v2 2/3] net: openvswitch: refactor flow free function xiangxia.m.yue
2020-08-24 13:09   ` David Miller
2020-08-24 13:56     ` Tonghao Zhang [this message]
2020-08-24  7:36 ` [PATCH net-next v2 3/3] net: openvswitch: remove unused keep_flows xiangxia.m.yue

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='CAMDZJNVzkbuc2Wx0dOd_JFEiNG+D9FFm0+PFrs2CFU7-x=F5kg@mail.gmail.com' \
    --to=xiangxia.m.yue@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dev@openvswitch.org \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@ovn.org \
    --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;
as well as URLs for NNTP newsgroup(s).