diff mbox series

[ovs-dev,v2,3/8] netlink-notifier: Drain socket on overflow.

Message ID 20260311060533.52598-4-amorenoz@redhat.com
State New
Headers show
Series netdev-linux: Use event-driven netlink notifications. | expand

Checks

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

Commit Message

Adrián Moreno March 11, 2026, 6:05 a.m. UTC
If the netlink socket overflows, we report an empty change to let all
notifiers know some events are lost and therefore they can no longer
trust their known state. This acts as a kind of reset.

Draining the socket makes sense here so that partial events are not
sent afterwards.

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
---
 lib/netlink-notifier.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mike Pattrick April 8, 2026, 1:01 p.m. UTC | #1
On Wed, Mar 11, 2026 at 2:06 AM Adrian Moreno via dev <
ovs-dev@openvswitch.org> wrote:

> If the netlink socket overflows, we report an empty change to let all
> notifiers know some events are lost and therefore they can no longer
> trust their known state. This acts as a kind of reset.
>
> Draining the socket makes sense here so that partial events are not
> sent afterwards.
>
> Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
> ---
>

This looks reasonable to me!

Acked-by: Mike Pattrick <mkp@redhat.com>
diff mbox series

Patch

diff --git a/lib/netlink-notifier.c b/lib/netlink-notifier.c
index 7ea5a4181..ea4742a90 100644
--- a/lib/netlink-notifier.c
+++ b/lib/netlink-notifier.c
@@ -200,6 +200,7 @@  nln_run(struct nln *nln)
             return;
         } else {
             if (error == ENOBUFS) {
+                nl_sock_drain(nln->notify_sock);
                 /* The socket buffer might be full, there could be too many
                  * notifications, so it makes sense to call nln_report() */
                 nln_report(nln, NULL, 0);