Skip to content

ovs: wait that links disappear during initial cleanup

Beniamino Galvani requested to merge bg/ovs-race into main

At startup, we remove from ovsdb any existing interface created by NM and later an interface with the same name might be readded. This can cause race conditions. Consider this series of events:

  1. at startup NM removes the entry from ovsdb;
  2. ovsdb reports success;
  3. NM inserts an interface with the same name again;
  4. ovs-vswitch monitors ovsdb changes, and gets events for removal and insertion. Depending on how those events are split in different batches, it might decide:
    • 4a. to delete the link and add it back, or
    • 4b. to keep the existing link because the delete and insertion cancel out each other.

When NM sees the link staying in platform, it doesn't know if it's because of 4b or because 4a will happen eventually.

To avoid this ambiguity, after ovsdb reports the successful deletion NM should also wait that the link disappears from platform.

Unfortunately, this means that ovsdb gets a dependency to the platform code.

Merge request reports