Calling these functions in the main thread lead to dead-lock and must
be avoided.

Signed-off-by: MORITA Kazutaka <morita.kazut...@lab.ntt.co.jp>
---
 sheep/request.c      | 2 ++
 sheep/sockfd_cache.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/sheep/request.c b/sheep/request.c
index c2f1d68..85d62c9 100644
--- a/sheep/request.c
+++ b/sheep/request.c
@@ -451,6 +451,8 @@ int exec_local_req(struct sd_req *rq, void *data)
        eventfd_t value = 1;
        int ret;
 
+       assert(is_worker_thread());
+
        req = alloc_local_request(data, rq->data_length);
        req->rq = *rq;
        req->local_req_efd = eventfd(0, 0);
diff --git a/sheep/sockfd_cache.c b/sheep/sockfd_cache.c
index 1e0d6cf..217472d 100644
--- a/sheep/sockfd_cache.c
+++ b/sheep/sockfd_cache.c
@@ -509,6 +509,8 @@ int sheep_exec_req(const struct node_id *nid, struct sd_req 
*hdr, void *buf)
        struct sockfd *sfd;
        int ret;
 
+       assert(is_worker_thread());
+
        sfd = sheep_get_sockfd(nid);
        if (!sfd)
                return SD_RES_NETWORK_ERROR;
-- 
1.8.1.3.566.gaa39828

-- 
sheepdog mailing list
sheepdog@lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to