summaryrefslogtreecommitdiff
path: root/libtrivfs/protid-dup.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-05-06 19:07:13 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-05-26 13:17:16 +0200
commit1d1da90042d2ee7a8215dc6291b54bc1ebe59fe4 (patch)
tree54c00f70a5703b40bb8243a6d76afd024c50cdaf /libtrivfs/protid-dup.c
parent5b039a12bf5cfc9c65b8e169ed4503e306f971f3 (diff)
libtrivfs: lock-less reference counting for trivfs_peropen objects
* libtrivfs/trivfs.h (struct trivfs_peropen): Use refcount_t for field refcnt. (struct trivfs_control): Remove unused field lock. * libtrivfs/cntl-create.c (trivfs_create_control): Drop the mutex initialization. * libtrivfs/io-reauthenticate.c (trivfs_S_io_reauthenticate): Adjust accordingly. * libtrivfs/io-restrict-auth.c (trivfs_S_io_restrict_auth): Likewise. * libtrivfs/open.c (trivfs_open): Initialize refcnt. * libtrivfs/protid-clean.c (trivfs_clean_protid): Likewise. * libtrivfs/protid-dup.c (trivfs_protid_dup): Likewise.
Diffstat (limited to 'libtrivfs/protid-dup.c')
-rw-r--r--libtrivfs/protid-dup.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/libtrivfs/protid-dup.c b/libtrivfs/protid-dup.c
index 61696032..75f3ca88 100644
--- a/libtrivfs/protid-dup.c
+++ b/libtrivfs/protid-dup.c
@@ -35,11 +35,8 @@ trivfs_protid_dup (struct trivfs_protid *cred, struct trivfs_protid **dup)
if (! err)
{
- pthread_mutex_lock (&cred->po->cntl->lock);
new->po = cred->po;
- new->po->refcnt++;
- pthread_mutex_unlock (&cred->po->cntl->lock);
-
+ refcount_ref (&new->po->refcnt);
new->isroot = cred->isroot;
err = iohelp_dup_iouser (&new->user, cred->user);