Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

orchagent would crash, when portsorch failed to remove bridge port #2961

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4415,7 +4415,12 @@ void PortsOrch::doVlanMemberTask(Consumer &consumer)
{
if (m_portVlanMember[port.m_alias].empty())
{
removeBridgePort(port);
if (!removeBridgePort(port))
{
SWSS_LOG_NOTICE("Failed to removeBridgePort %s",port.m_alias.c_str());
it++;
continue;
}
}
it = consumer.m_toSync.erase(it);
}
Expand All @@ -4424,6 +4429,19 @@ void PortsOrch::doVlanMemberTask(Consumer &consumer)
it++;
}
}
else if (m_portVlanMember[port.m_alias].empty() && port.m_bridge_port_id != SAI_NULL_OBJECT_ID)
{
SWSS_LOG_WARN("Port %s was removed from vlan, but it is still as bridge port OID %" PRIx64 ", try to remove bridge port again", port.m_alias.c_str(), port.m_bridge_port_id);
if (!removeBridgePort(port))
{
it++;
continue;
}
else
{
it = consumer.m_toSync.erase(it);
}
}
else
/* Cannot locate the VLAN */
it = consumer.m_toSync.erase(it);
Expand Down Expand Up @@ -5437,11 +5455,15 @@ bool PortsOrch::removeBridgePort(Port &port)
{
SWSS_LOG_ERROR("Failed to remove bridge port %s from default 1Q bridge, rv:%d",
port.m_alias.c_str(), status);
#if 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot have dead code.

task_process_status handle_status = handleSaiRemoveStatus(SAI_API_BRIDGE, status);
if (handle_status != task_success)
{
return parseHandleSaiStatusFailure(handle_status);
}
#else
return false;
#endif
}
saiOidToAlias.erase(port.m_bridge_port_id);
port.m_bridge_port_id = SAI_NULL_OBJECT_ID;
Expand Down
Loading