summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2021-02-02 16:21:58 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2021-02-04 10:47:51 +0100
commita980d9916dbd958813069cf305eab64380242557 (patch)
treef7dc587d36f1d53b9bb7d1eabfe0700c325fb660
parentcbb59e33084b9058dafc391c10213f3eabdba764 (diff)
downloadNetworkManager-bg/rh1923248.tar.gz
ovs: avoid race condition when system interface is removed from ovsdbbg/rh1923248
Failing the system interface device is almost always the right thing to do when the ovsdb entry is removed. However, to avoid that a late device-removed signal tears down a different, newly-activated connection, let's also check that we have a master. Or in alternative, that the device is assumed/external: in such case it's always fine to fail the device Fixes: 8e55efeb9dff ('ovs: fail OVS system interfaces when the db entry gets removed') https://bugzilla.redhat.com/show_bug.cgi?id=1923248 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/741
-rw-r--r--src/core/devices/ovs/nm-ovs-factory.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/devices/ovs/nm-ovs-factory.c b/src/core/devices/ovs/nm-ovs-factory.c
index 10b6d7f419..d5875bc118 100644
--- a/src/core/devices/ovs/nm-ovs-factory.c
+++ b/src/core/devices/ovs/nm-ovs-factory.c
@@ -165,6 +165,16 @@ ovsdb_device_removed(NMOvsdb * ovsdb,
continue;
if (!nm_streq0(nm_setting_ovs_interface_get_interface_type(s_ovs_int), "system"))
continue;
+ /* Failing the system interface device is almost always the right
+ * thing to do when the ovsdb entry is removed. However, to avoid
+ * that a late device-removed signal tears down a different,
+ * newly-activated connection, let's also check that we have a master.
+ * Or in alternative, that the device is assumed/external: in such
+ * case it's always fine to fail the device.
+ */
+ if (!nm_device_get_master(d) && !nm_device_sys_iface_state_is_external_or_assume(d))
+ continue;
+
device = d;
}
} else {