Skip to content

Commit 59b0430

Browse files
authored
[syncd] Unlock vendor api lock if enabling diag shell (sonic-net#571)
1 parent 910d45e commit 59b0430

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

syncd/VendorSai.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ sai_status_t VendorSai::set(
190190
_In_ sai_object_id_t objectId,
191191
_In_ const sai_attribute_t *attr)
192192
{
193-
MUTEX();
193+
std::unique_lock<std::mutex> _lock(m_apimutex);
194194
SWSS_LOG_ENTER();
195195
VENDOR_CHECK_API_INITIALIZED();
196196

@@ -222,6 +222,13 @@ sai_status_t VendorSai::set(
222222

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

225+
if (objectType == SAI_OBJECT_TYPE_SWITCH && attr && attr->id == SAI_SWITCH_ATTR_SWITCH_SHELL_ENABLE)
226+
{
227+
// in case of diagnostic shell, this vendor api can be blocking, so
228+
// release lock here to not cause deadlock for other events in syncd
229+
_lock.unlock();
230+
}
231+
225232
return info->set(&mk, attr);
226233
}
227234

0 commit comments

Comments
 (0)