Commit 331bc71c authored by Trond Myklebust's avatar Trond Myklebust

SUNRPC: Convert the auth cred cache to use refcount_t

Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 79b18181
...@@ -100,7 +100,7 @@ struct rpc_auth { ...@@ -100,7 +100,7 @@ struct rpc_auth {
* differ from the flavor in * differ from the flavor in
* au_ops->au_flavor in gss * au_ops->au_flavor in gss
* case) */ * case) */
atomic_t au_count; /* Reference counter */ refcount_t au_count; /* Reference counter */
struct rpc_cred_cache * au_credcache; struct rpc_cred_cache * au_credcache;
/* per-flavor data */ /* per-flavor data */
......
...@@ -284,7 +284,7 @@ EXPORT_SYMBOL_GPL(rpcauth_create); ...@@ -284,7 +284,7 @@ EXPORT_SYMBOL_GPL(rpcauth_create);
void void
rpcauth_release(struct rpc_auth *auth) rpcauth_release(struct rpc_auth *auth)
{ {
if (!atomic_dec_and_test(&auth->au_count)) if (!refcount_dec_and_test(&auth->au_count))
return; return;
auth->au_ops->destroy(auth); auth->au_ops->destroy(auth);
} }
......
...@@ -274,7 +274,7 @@ static const struct rpc_authops generic_auth_ops = { ...@@ -274,7 +274,7 @@ static const struct rpc_authops generic_auth_ops = {
static struct rpc_auth generic_auth = { static struct rpc_auth generic_auth = {
.au_ops = &generic_auth_ops, .au_ops = &generic_auth_ops,
.au_count = ATOMIC_INIT(0), .au_count = REFCOUNT_INIT(1),
}; };
static bool generic_key_to_expire(struct rpc_cred *cred) static bool generic_key_to_expire(struct rpc_cred *cred)
......
...@@ -1058,7 +1058,7 @@ gss_create_new(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt) ...@@ -1058,7 +1058,7 @@ gss_create_new(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt)
auth->au_flavor = flavor; auth->au_flavor = flavor;
if (gss_pseudoflavor_to_datatouch(gss_auth->mech, flavor)) if (gss_pseudoflavor_to_datatouch(gss_auth->mech, flavor))
auth->au_flags |= RPCAUTH_AUTH_DATATOUCH; auth->au_flags |= RPCAUTH_AUTH_DATATOUCH;
atomic_set(&auth->au_count, 1); refcount_set(&auth->au_count, 1);
kref_init(&gss_auth->kref); kref_init(&gss_auth->kref);
err = rpcauth_init_credcache(auth); err = rpcauth_init_credcache(auth);
...@@ -1187,7 +1187,7 @@ gss_auth_find_or_add_hashed(const struct rpc_auth_create_args *args, ...@@ -1187,7 +1187,7 @@ gss_auth_find_or_add_hashed(const struct rpc_auth_create_args *args,
if (strcmp(gss_auth->target_name, args->target_name)) if (strcmp(gss_auth->target_name, args->target_name))
continue; continue;
} }
if (!atomic_inc_not_zero(&gss_auth->rpc_auth.au_count)) if (!refcount_inc_not_zero(&gss_auth->rpc_auth.au_count))
continue; continue;
goto out; goto out;
} }
......
...@@ -21,7 +21,7 @@ static struct rpc_cred null_cred; ...@@ -21,7 +21,7 @@ static struct rpc_cred null_cred;
static struct rpc_auth * static struct rpc_auth *
nul_create(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt) nul_create(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt)
{ {
atomic_inc(&null_auth.au_count); refcount_inc(&null_auth.au_count);
return &null_auth; return &null_auth;
} }
...@@ -119,7 +119,7 @@ struct rpc_auth null_auth = { ...@@ -119,7 +119,7 @@ struct rpc_auth null_auth = {
.au_flags = RPCAUTH_AUTH_NO_CRKEY_TIMEOUT, .au_flags = RPCAUTH_AUTH_NO_CRKEY_TIMEOUT,
.au_ops = &authnull_ops, .au_ops = &authnull_ops,
.au_flavor = RPC_AUTH_NULL, .au_flavor = RPC_AUTH_NULL,
.au_count = ATOMIC_INIT(0), .au_count = REFCOUNT_INIT(1),
}; };
static static
......
...@@ -34,7 +34,7 @@ unx_create(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt) ...@@ -34,7 +34,7 @@ unx_create(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt)
{ {
dprintk("RPC: creating UNIX authenticator for client %p\n", dprintk("RPC: creating UNIX authenticator for client %p\n",
clnt); clnt);
atomic_inc(&unix_auth.au_count); refcount_inc(&unix_auth.au_count);
return &unix_auth; return &unix_auth;
} }
...@@ -239,7 +239,7 @@ struct rpc_auth unix_auth = { ...@@ -239,7 +239,7 @@ struct rpc_auth unix_auth = {
.au_flags = RPCAUTH_AUTH_NO_CRKEY_TIMEOUT, .au_flags = RPCAUTH_AUTH_NO_CRKEY_TIMEOUT,
.au_ops = &authunix_ops, .au_ops = &authunix_ops,
.au_flavor = RPC_AUTH_UNIX, .au_flavor = RPC_AUTH_UNIX,
.au_count = ATOMIC_INIT(0), .au_count = REFCOUNT_INIT(1),
}; };
static static
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment