Skip to content

Commit

Permalink
[syncd] Unlock vendor api lock if enabling diag shell (sonic-net#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik authored Mar 16, 2020
1 parent 910d45e commit 59b0430
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion syncd/VendorSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ sai_status_t VendorSai::set(
_In_ sai_object_id_t objectId,
_In_ const sai_attribute_t *attr)
{
MUTEX();
std::unique_lock<std::mutex> _lock(m_apimutex);
SWSS_LOG_ENTER();
VENDOR_CHECK_API_INITIALIZED();

Expand Down Expand Up @@ -222,6 +222,13 @@ sai_status_t VendorSai::set(

sai_object_meta_key_t mk = { .objecttype = objectType, .objectkey = { .key = { .object_id = objectId } } };

if (objectType == SAI_OBJECT_TYPE_SWITCH && attr && attr->id == SAI_SWITCH_ATTR_SWITCH_SHELL_ENABLE)
{
// in case of diagnostic shell, this vendor api can be blocking, so
// release lock here to not cause deadlock for other events in syncd
_lock.unlock();
}

return info->set(&mk, attr);
}

Expand Down

0 comments on commit 59b0430

Please sign in to comment.