summaryrefslogtreecommitdiffstats
path: root/src/plugins/dns/dns.h
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-08-22 19:32:49 -0400
committerDave Barach <dave@barachs.net>2019-08-22 19:33:34 -0400
commit84a563ae4050cc0389dcd438fbe9ea882f2b8404 (patch)
tree18b9db5ecbd3cd9480f6f94e237720321c2b877f /src/plugins/dns/dns.h
parenta43c93f8554ad7418e31be3791b3fb71232f60ac (diff)
dns: fix trivial multi-thread deadlock
Add a simple lock trace mechanism Type: fix Ticket: VPP-1752 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Idc82b1ad59adb0f7c185d27ced57e9a4c25ce62f
Diffstat (limited to 'src/plugins/dns/dns.h')
-rw-r--r--src/plugins/dns/dns.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/dns/dns.h b/src/plugins/dns/dns.h
index 0a3f7a935cb..499c71567d6 100644
--- a/src/plugins/dns/dns.h
+++ b/src/plugins/dns/dns.h
@@ -99,6 +99,7 @@ typedef struct
/** Find cached record by name */
uword *cache_entry_by_name;
clib_spinlock_t cache_lock;
+ int cache_lock_tag;
/** enable / disable flag */
int is_enabled;
@@ -198,11 +199,14 @@ void vnet_dns_create_resolver_process (dns_main_t * dm);
format_function_t format_dns_reply;
static inline void
-dns_cache_lock (dns_main_t * dm)
+dns_cache_lock (dns_main_t * dm, int tag)
{
if (dm->cache_lock)
{
+ ASSERT (tag);
+ ASSERT (dm->cache_lock_tag == 0);
clib_spinlock_lock (&dm->cache_lock);
+ dm->cache_lock_tag = tag;
}
}
@@ -211,6 +215,8 @@ dns_cache_unlock (dns_main_t * dm)
{
if (dm->cache_lock)
{
+ ASSERT (dm->cache_lock_tag);
+ dm->cache_lock_tag = 0;
clib_spinlock_unlock (&dm->cache_lock);
}
}