summaryrefslogtreecommitdiffstats
path: root/src/sss_client/nss_mc_common.c
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2015-06-30 20:19:42 +0200
committerJakub Hrozek <jhrozek@redhat.com>2015-07-03 15:17:08 +0200
commit0ed6114c6b2cc9d7e0c09842d19f0987e9ebbb4a (patch)
tree6efd08c1bab1b53c9f062e2481396e735b0c36e7 /src/sss_client/nss_mc_common.c
parentb08bcc387ad99b9c408183960c127dc77975b6ff (diff)
downloadsssd-0ed6114c6b2cc9d7e0c09842d19f0987e9ebbb4a.tar.gz
sssd-0ed6114c6b2cc9d7e0c09842d19f0987e9ebbb4a.tar.xz
sssd-0ed6114c6b2cc9d7e0c09842d19f0987e9ebbb4a.zip
sss_client: Use unique lock for memory cache
Previously the sma lock was used as for communication with responder. However it would cause a deadlock in case of re-checking memcache after acquiring the lock and before communication with responder.. Required by: https://fedorahosted.org/sssd/ticket/2581 Reviewed-by: Michal Židek <mzidek@redhat.com>
Diffstat (limited to 'src/sss_client/nss_mc_common.c')
-rw-r--r--src/sss_client/nss_mc_common.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sss_client/nss_mc_common.c b/src/sss_client/nss_mc_common.c
index 89ff6b46e..707d1249f 100644
--- a/src/sss_client/nss_mc_common.c
+++ b/src/sss_client/nss_mc_common.c
@@ -121,7 +121,7 @@ static errno_t sss_nss_mc_init_ctx(const char *name,
char *file = NULL;
int ret;
- sss_nss_lock();
+ sss_nss_mc_lock();
/* check if ctx is initialised by previous thread. */
if (ctx->initialized != UNINITIALIZED) {
ret = sss_nss_check_header(ctx);
@@ -172,7 +172,7 @@ done:
sss_nss_mc_destroy_ctx(ctx);
}
free(file);
- sss_nss_unlock();
+ sss_nss_mc_unlock();
return ret;
}
@@ -217,11 +217,11 @@ errno_t sss_nss_mc_get_ctx(const char *name, struct sss_cli_mc_ctx *ctx)
}
if (ctx->initialized == RECYCLED && ctx->active_threads == 0) {
/* just one thread should call munmap */
- sss_nss_lock();
+ sss_nss_mc_lock();
if (ctx->initialized == RECYCLED) {
sss_nss_mc_destroy_ctx(ctx);
}
- sss_nss_unlock();
+ sss_nss_mc_unlock();
}
if (need_decrement) {
/* In case of error, we will not touch mmapped area => decrement */