From 1d1da90042d2ee7a8215dc6291b54bc1ebe59fe4 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Tue, 6 May 2014 19:07:13 +0200 Subject: 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. --- libtrivfs/io-reauthenticate.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'libtrivfs/io-reauthenticate.c') diff --git a/libtrivfs/io-reauthenticate.c b/libtrivfs/io-reauthenticate.c index 7677697a..df0ed2ee 100644 --- a/libtrivfs/io-reauthenticate.c +++ b/libtrivfs/io-reauthenticate.c @@ -62,11 +62,8 @@ trivfs_S_io_reauthenticate (struct trivfs_protid *cred, newcred->isroot = 1; newcred->hook = cred->hook; - - pthread_mutex_lock (&cred->po->cntl->lock); newcred->po = cred->po; - newcred->po->refcnt++; - pthread_mutex_unlock (&cred->po->cntl->lock); + refcount_ref (&newcred->po->refcnt); do err = io_restrict_auth (newcred->po->cntl->underlying, &newcred->realnode, -- cgit v1.2.3