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

Fixed set mtu for deleted subintf due to late notification #2571

Merged
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
15 changes: 13 additions & 2 deletions cfgmgr/intfmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,19 @@ std::string IntfMgr::setHostSubIntfMtu(const string &alias, const string &mtu, c
}
SWSS_LOG_INFO("subintf %s active mtu: %s", alias.c_str(), subifMtu.c_str());
cmd << IP_CMD " link set " << shellquote(alias) << " mtu " << shellquote(subifMtu);
EXEC_WITH_ERROR_THROW(cmd.str(), res);
std::string cmd_str = cmd.str();
int ret = swss::exec(cmd_str, res);

if (ret && !isIntfStateOk(alias))
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is already checked in the doIntfGeneralTask under SET operation. So why check again here? is there a race condition?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are not visiting the "doIntfGeneralTask" function in this flow.
The flow is:

  1. changing the "mtu" field in the PORT_TABLE in state DB
  2. doTask
  3. doPortTableTask
  4. updateSubIntfMtu
  5. setHostSubIntfMtu

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok, does this happen in the updateSubIntfAdminStatus flow as well? Or why only mtu change is handled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is happen in the updateSubIntfAdminStatus flow as well

{
// Can happen when a SET notification on the PORT_TABLE in the State DB
// followed by a new DEL notification that send by portmgrd
SWSS_LOG_WARN("Setting mtu to %s netdev failed with cmd:%s, rc:%d, error:%s", alias.c_str(), cmd_str.c_str(), ret, res.c_str());
}
else if (ret)
{
throw runtime_error(cmd_str + " : " + res);
}
return subifMtu;
}

Expand All @@ -468,7 +479,7 @@ void IntfMgr::updateSubIntfAdminStatus(const string &alias, const string &admin)
continue;
}
std::vector<FieldValueTuple> fvVector;
string subintf_admin = setHostSubIntfAdminStatus(intf, m_subIntfList[intf].adminStatus, admin);
string subintf_admin = setHostSubIntfAdminStatus(intf, m_subIntfList[intf].adminStatus, admin);
m_subIntfList[intf].currAdminStatus = subintf_admin;
FieldValueTuple fvTuple("admin_status", subintf_admin);
fvVector.push_back(fvTuple);
Expand Down