Skip to content

Commit

Permalink
Fix issue: remove VRF routing table when it is still used
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Sun <stephens@nvidia.com>
  • Loading branch information
stephenxs committed Jan 21, 2025
1 parent 6567843 commit eea6cfa
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions orchagent/routeorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2433,13 +2433,21 @@ bool RouteOrch::removeRoute(RouteBulkContext& ctx)
size_t creating = gRouteBulker.creating_entries_count(route_entry);
if (it_route == it_route_table->second.end() && creating == 0)
{
if (it_route_table->second.size() == 0)
{
/*
* Clean up the VRF routing table if
* 1. there is no routing entry in the VRF routing table and
* 2. there is no pending creating rouing entry in gRouteBulker
* The ideal way of the 2nd condition is to check pending creating entries of a certain VRF, which we can not do.
* However, we can not check whether there is a pending creating entry of a certain VRF in the gRouteBulker
* So, we use a strict condition here.
*/
if (it_route_table->second.size() == 0 && gRouteBulker.creating_entries_count() == 0)
{
m_syncdRoutes.erase(vrf_id);
m_vrfOrch->decreaseVrfRefCount(vrf_id);
}
SWSS_LOG_INFO("Failed to find route entry, vrf_id 0x%" PRIx64 ", prefix %s\n", vrf_id,
ipPrefix.to_string().c_str());
}
SWSS_LOG_INFO("Failed to find route entry, vrf_id 0x%" PRIx64 ", prefix %s\n", vrf_id,
ipPrefix.to_string().c_str());

return true;
}
Expand Down

0 comments on commit eea6cfa

Please sign in to comment.