From adb1ae9992765dedc8baa47e383b1a1ba4d9a308 Mon Sep 17 00:00:00 2001 From: Jakub Jermar Date: Thu, 9 Nov 2017 21:29:25 +0100 Subject: [PATCH] Answer IPC only when there will be no blocking This is necessary so that a parallel exchange is not handled by a connection fibril which is still itself waiting for IPC or resources. --- uspace/srv/locsrv/locsrv.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/uspace/srv/locsrv/locsrv.c b/uspace/srv/locsrv/locsrv.c index 4adf9e690..7ff36fbe1 100644 --- a/uspace/srv/locsrv/locsrv.c +++ b/uspace/srv/locsrv/locsrv.c @@ -556,9 +556,14 @@ static void loc_service_unregister(ipc_callid_t iid, ipc_call_t *icall, loc_service_unregister_core(svc); fibril_mutex_unlock(&cdir.mutex); fibril_mutex_unlock(&services_list_mutex); - async_answer_0(iid, EOK); + /* + * First send out all notifications and only then answer the request. + * Otherwise the current fibril might block and transitively wait for + * the completion of requests that are routed to it via an IPC loop. + */ loc_category_change_event(); + async_answer_0(iid, EOK); } static void loc_category_get_name(ipc_callid_t iid, ipc_call_t *icall) @@ -1296,9 +1301,13 @@ static void loc_service_add_to_cat(ipc_callid_t iid, ipc_call_t *icall) fibril_mutex_unlock(&cdir.mutex); fibril_mutex_unlock(&services_list_mutex); - async_answer_0(iid, retval); - + /* + * First send out all notifications and only then answer the request. + * Otherwise the current fibril might block and transitively wait for + * the completion of requests that are routed to it via an IPC loop. + */ loc_category_change_event(); + async_answer_0(iid, retval); } -- 2.11.4.GIT