From: Wilson Peng <pweis...@vmware.com> v2-v3 change: Remove the unneeded sanity check and just correct the failure when OvsNatInit is called failed.
While deploying Tanzu Kubernetes(Antrea based solution) in Broadcom customer, Sometimes it is found that the kernel thread OvsConntrackEntryCleaner is not Started after the Windows node is rebooted on unexpected condition. It could Be also observed a similar issue in local Antrea setup via Clean-AntreaNetwork.ps1 Which will Remove-VMSwitch and re-create it on Windows node. After checking the local conntrack dump, OVS doesn’t remove the connection Entries even though the time is overdue, we could find the connection entries Created several hours ago in the dump, within a state (TIME_WAIT) that was Supposed to be deleted earlier. At that time, the count of the existing entries In the OVS conntrack zone is far from the up limit, the actual number is 19k. Then we tried to flush the conntrack with CMD "ovs-dpctl.exe flush-conntrack" And all the conntrack entries could be removed. In this patch, it does make sure return wrong value when OvsNatInit is failed To call on OvsInitConntrack.And also it is to correct the failure inside OvsNatInit and OvsNatCleanup. Antrea team does help do the regression test with build including the patch And it could PASS the testing. And it is not find the Connectract not timeout Essue with same reproducing condition. It is good to backport the fix to main and backported until 2.17. Signed-off-by: Wilson Peng <pweis...@vmware.com> --- datapath-windows/ovsext/Conntrack-nat.c | 2 +- datapath-windows/ovsext/Conntrack.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/datapath-windows/ovsext/Conntrack-nat.c b/datapath-windows/ovsext/Conntrack-nat.c index 497354ec8..a222f6aea 100644 --- a/datapath-windows/ovsext/Conntrack-nat.c +++ b/datapath-windows/ovsext/Conntrack-nat.c @@ -108,6 +108,7 @@ NTSTATUS OvsNatInit() OVS_CT_POOL_TAG); if (ovsUnNatTable == NULL) { OvsFreeMemoryWithTag(ovsNatTable, OVS_CT_POOL_TAG); + ovsNatTable = NULL; return STATUS_INSUFFICIENT_RESOURCES; } @@ -157,7 +158,6 @@ VOID OvsNatFlush(UINT16 zone) VOID OvsNatCleanup() { if (ovsNatTable == NULL) { - NdisFreeSpinLock(&ovsCtNatLock); return; } diff --git a/datapath-windows/ovsext/Conntrack.c b/datapath-windows/ovsext/Conntrack.c index 39ba5cc10..459819851 100644 --- a/datapath-windows/ovsext/Conntrack.c +++ b/datapath-windows/ovsext/Conntrack.c @@ -119,7 +119,7 @@ OvsInitConntrack(POVS_SWITCH_CONTEXT context) if (status != STATUS_SUCCESS) { OvsCleanupConntrack(); } - return STATUS_SUCCESS; + return status; freeBucketLock: for (UINT32 i = 0; i < numBucketLocks; i++) { @@ -172,6 +172,7 @@ OvsCleanupConntrack(VOID) NdisFreeSpinLock(&ovsCtZoneLock); if (zoneInfo) { OvsFreeMemoryWithTag(zoneInfo, OVS_CT_POOL_TAG); + zoneInfo = NULL; } } @@ -1520,6 +1521,8 @@ OvsConntrackEntryCleaner(PVOID data) LOCK_STATE_EX lockState; BOOLEAN success = TRUE; + OVS_LOG_INFO("Start the OVS ConntrackEntry Cleaner system thread," + " context: %p", context); while (success) { if (context->exit) { break; @@ -1541,6 +1544,7 @@ OvsConntrackEntryCleaner(PVOID data) KeWaitForSingleObject(&context->event, Executive, KernelMode, FALSE, (LARGE_INTEGER *)&threadSleepTimeout); } + OVS_LOG_INFO("Terminate the OVS ConntrackEntry Cleaner system thread"); PsTerminateSystemThread(STATUS_SUCCESS); } -- 2.39.2 (Apple Git-143) _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev