The datapath records the user features before it applies the change, so
a request that fails leaves it claiming a bit whose reference count was
never taken. The first patch records the features last. The second adds a
selftest that drives the failing request and reads back what the datapath
reports.
v4:
- Rebased onto current main.
- The skip message is one printf again. Splitting it made shellcheck
report SC2182 and dropped a word and the newline from the output.
- The new tests say why they failed on stdout. info() writes debug.log
and a failing run deletes that file, so CI showed a FAIL with no reason.
- A datapath that cannot be read is reported as that instead of as a
feature mismatch.
- The outdated add-dp request is checked instead of discarded.
- The errno numbers come from python rather than from a literal, and a
lookup that cannot answer says so rather than comparing against an
empty string.
v3: https://lore.kernel.org/netdev/20261110174651.972936-1-houminxi@gmail.com/ (local)
- Cover the recirc bit as well as the dispatch bit.
v2: https://lore.kernel.org/netdev/20261108123424.2825403-1-houminxi@gmail.com/ (local)
- Name the two paths that leaked a reference and fix both.
v1: https://lore.kernel.org/netdev/20261107113403.797779-1-houminxi@gmail.com/ (local)
Neither leak has a test of its own. The reference count behind the bit is
not visible from user space, so the tests read back the features a
datapath reports: the reset drops them to zero where a test can see it,
and a datapath freed after a failed creation leaves no state to check.
One thing this series leaves alone: ovs_add_dp() returns the status of the
last command in its body rather than of the add, so the `|| return 1` that
follows its calls cannot fail. That predates this series and every OVS
test shares it. The two tests here do not depend on it.
Signed-off-by: Minxi Hou <redacted>
Minxi Hou (2):
net: openvswitch: do not record user features when the change fails
selftests/net/openvswitch: check that a failed set keeps the features
net/openvswitch/datapath.c | 34 ++--
net/openvswitch/datapath.h | 5 +-
.../testing/selftests/net/openvswitch/config | 3 +
.../selftests/net/openvswitch/openvswitch.sh | 173 ++++++++++++++++++
.../selftests/net/openvswitch/ovs-dpctl.py | 61 ++++++
5 files changed, 262 insertions(+), 14 deletions(-)
base-commit: 6964ff21c5d8b75649211a52dbfd92753e605649
--
2.56.1