From afea5285b0e40b68f97b47f0f0edc471b554fb34 Mon Sep 17 00:00:00 2001 From: Flavio Cruz Date: Sun, 7 Feb 2016 01:33:00 -0500 Subject: Use refcount_t for peropen reference counting in libnetfs. * libnetfs/netfs.h: Use refcount_t. * libnetfs/make-peropen.c: Initialize to 1 with refcount_init just like in libdiskfs. * libnetfs/make-protid.c: Don't increment the count here. Do it like libdiskfs. * libnetfs/io-duplicate.c: Add refcount_ref since netfs_make_protid no longer increments the refcount. * libnetfs/io-reauthenticate.c: Likewise. * libnetfs/io-restrict-auth.c: Likewise. * libnetfs/release-peropen.c: Dereference without locking. --- libnetfs/io-restrict-auth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libnetfs/io-restrict-auth.c') diff --git a/libnetfs/io-restrict-auth.c b/libnetfs/io-restrict-auth.c index 0c3403d8..79b7d095 100644 --- a/libnetfs/io-restrict-auth.c +++ b/libnetfs/io-restrict-auth.c @@ -43,6 +43,7 @@ netfs_S_io_restrict_auth (struct protid *user, return err; pthread_mutex_lock (&user->po->np->lock); + refcount_ref (&user->po->refcnt); newpi = netfs_make_protid (user->po, new_user); if (newpi) { @@ -52,6 +53,7 @@ netfs_S_io_restrict_auth (struct protid *user, } else { + refcount_deref (&user->po->refcnt); pthread_mutex_unlock (&user->po->np->lock); iohelp_free_iouser (new_user); err = ENOMEM; -- cgit v1.2.3