summaryrefslogtreecommitdiffstats
path: root/utils/gssd/krb5_util.c
diff options
context:
space:
mode:
authorOlga Kornievskaia <kolga@netapp.com>2016-04-28 16:21:41 -0400
committerSteve Dickson <steved@redhat.com>2016-04-29 10:37:53 -0400
commit8c34e538ef7492fda87b640343996dd33a2fde1d (patch)
tree32f61476c24357e9c1d717ee181013999924ae73 /utils/gssd/krb5_util.c
parentbf97c20a6c3b8d037663e23a39bcf2f003ec12ee (diff)
downloadnfs-utils-8c34e538ef7492fda87b640343996dd33a2fde1d.tar.gz
nfs-utils-8c34e538ef7492fda87b640343996dd33a2fde1d.tar.xz
nfs-utils-8c34e538ef7492fda87b640343996dd33a2fde1d.zip
gssd: use pthreads to handle upcalls
Currently, to persevere global data over multiple mounts, the root process does not fork when handling an upcall. Instead on not-forking create a pthread to handle the upcall since global data can be shared among threads. Reviewed-by: Jeff Layton <jlayton@poochiereds.net> Signed-off-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/gssd/krb5_util.c')
-rw-r--r--utils/gssd/krb5_util.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index 8dc64fe..a690043 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -128,6 +128,7 @@
/* Global list of principals/cache file names for machine credentials */
struct gssd_k5_kt_princ *gssd_k5_kt_princ_list = NULL;
+pthread_mutex_t ple_lock = PTHREAD_MUTEX_INITIALIZER;
#ifdef HAVE_SET_ALLOWABLE_ENCTYPES
int limit_to_legacy_enctypes = 0;
@@ -586,10 +587,12 @@ get_ple_by_princ(krb5_context context, krb5_principal princ)
/* Need to serialize list if we ever become multi-threaded! */
+ pthread_mutex_lock(&ple_lock);
ple = find_ple_by_princ(context, princ);
if (ple == NULL) {
ple = new_ple(context, princ);
}
+ pthread_mutex_unlock(&ple_lock);
return ple;
}