diff mbox series

[ovs-dev,v2] ofproto-dpif-xlate: remove mirror assert

Message ID 1651217564-14168-1-git-send-email-lic121@chinatelecom.cn
State Accepted
Commit dd4d8e34ba5d246112a267e913339d28fb984223
Headers show
Series [ovs-dev,v2] ofproto-dpif-xlate: remove mirror assert | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Cheng Li April 29, 2022, 7:32 a.m. UTC
During the revalidation/upcall, mirror could be removed. Instead of crash
the process, we can simply skip the deleted mirror.

The issue had been triggered multiple times by ovs-tcpdump in my test.

Fixes: ec7ceaed4f3e ("ofproto-dpif: Modularize mirror code.")
Signed-off-by: lic121 <lic121@chinatelecom.cn>
Tested-by: Adrian Moreno <amorenoz@redhat.com>
---
 ofproto/ofproto-dpif-xlate.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Ilya Maximets May 4, 2022, 9:31 p.m. UTC | #1
On 4/29/22 09:32, lic121 wrote:
> During the revalidation/upcall, mirror could be removed. Instead of crash
> the process, we can simply skip the deleted mirror.
> 
> The issue had been triggered multiple times by ovs-tcpdump in my test.
> 
> Fixes: ec7ceaed4f3e ("ofproto-dpif: Modularize mirror code.")
> Signed-off-by: lic121 <lic121@chinatelecom.cn>
> Tested-by: Adrian Moreno <amorenoz@redhat.com>
> ---
>  ofproto/ofproto-dpif-xlate.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Thanks!  Applied and backported down to 2.13.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 5a770f1..8a5632d 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -2142,9 +2142,14 @@  mirror_packet(struct xlate_ctx *ctx, struct xbundle *xbundle,
         int snaplen;
 
         /* Get the details of the mirror represented by the rightmost 1-bit. */
-        ovs_assert(mirror_get(xbridge->mbridge, raw_ctz(mirrors),
-                              &vlans, &dup_mirrors,
-                              &out, &snaplen, &out_vlan));
+        if (OVS_UNLIKELY(!mirror_get(xbridge->mbridge, raw_ctz(mirrors),
+                                     &vlans, &dup_mirrors,
+                                     &out, &snaplen, &out_vlan))) {
+            /* The mirror got reconfigured before we got to read it's
+             * configuration. */
+            mirrors = zero_rightmost_1bit(mirrors);
+            continue;
+        }
 
 
         /* If this mirror selects on the basis of VLAN, and it does not select