diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2018-10-14 10:40:29 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2018-10-23 12:24:33 -0400 |
commit | 331bc71cb1751d78f6807ad8e6162b07c67cdd1b (patch) | |
tree | 4aee4da7e0218075ee19b440bf8115c5012483ac | |
parent | 79b181810285a6b9b7a1aed25c365c9e1782e22a (diff) |
SUNRPC: Convert the auth cred cache to use refcount_t
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-rw-r--r-- | include/linux/sunrpc/auth.h | 2 | ||||
-rw-r--r-- | net/sunrpc/auth.c | 2 | ||||
-rw-r--r-- | net/sunrpc/auth_generic.c | 2 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 4 | ||||
-rw-r--r-- | net/sunrpc/auth_null.c | 4 | ||||
-rw-r--r-- | net/sunrpc/auth_unix.c | 4 |
6 files changed, 9 insertions, 9 deletions
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index a71d4bd191e7..c4db9424b63b 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h | |||
@@ -100,7 +100,7 @@ struct rpc_auth { | |||
100 | * differ from the flavor in | 100 | * differ from the flavor in |
101 | * au_ops->au_flavor in gss | 101 | * au_ops->au_flavor in gss |
102 | * case) */ | 102 | * case) */ |
103 | atomic_t au_count; /* Reference counter */ | 103 | refcount_t au_count; /* Reference counter */ |
104 | 104 | ||
105 | struct rpc_cred_cache * au_credcache; | 105 | struct rpc_cred_cache * au_credcache; |
106 | /* per-flavor data */ | 106 | /* per-flavor data */ |
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 4903eda5dd61..ad8ead738981 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -284,7 +284,7 @@ EXPORT_SYMBOL_GPL(rpcauth_create); | |||
284 | void | 284 | void |
285 | rpcauth_release(struct rpc_auth *auth) | 285 | rpcauth_release(struct rpc_auth *auth) |
286 | { | 286 | { |
287 | if (!atomic_dec_and_test(&auth->au_count)) | 287 | if (!refcount_dec_and_test(&auth->au_count)) |
288 | return; | 288 | return; |
289 | auth->au_ops->destroy(auth); | 289 | auth->au_ops->destroy(auth); |
290 | } | 290 | } |
diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c index f1df9837f1ac..d8831b988b1e 100644 --- a/net/sunrpc/auth_generic.c +++ b/net/sunrpc/auth_generic.c | |||
@@ -274,7 +274,7 @@ static const struct rpc_authops generic_auth_ops = { | |||
274 | 274 | ||
275 | static struct rpc_auth generic_auth = { | 275 | static struct rpc_auth generic_auth = { |
276 | .au_ops = &generic_auth_ops, | 276 | .au_ops = &generic_auth_ops, |
277 | .au_count = ATOMIC_INIT(0), | 277 | .au_count = REFCOUNT_INIT(1), |
278 | }; | 278 | }; |
279 | 279 | ||
280 | static bool generic_key_to_expire(struct rpc_cred *cred) | 280 | static bool generic_key_to_expire(struct rpc_cred *cred) |
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index c898a7c75e84..30f970cdc7f6 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -1058,7 +1058,7 @@ gss_create_new(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt) | |||
1058 | auth->au_flavor = flavor; | 1058 | auth->au_flavor = flavor; |
1059 | if (gss_pseudoflavor_to_datatouch(gss_auth->mech, flavor)) | 1059 | if (gss_pseudoflavor_to_datatouch(gss_auth->mech, flavor)) |
1060 | auth->au_flags |= RPCAUTH_AUTH_DATATOUCH; | 1060 | auth->au_flags |= RPCAUTH_AUTH_DATATOUCH; |
1061 | atomic_set(&auth->au_count, 1); | 1061 | refcount_set(&auth->au_count, 1); |
1062 | kref_init(&gss_auth->kref); | 1062 | kref_init(&gss_auth->kref); |
1063 | 1063 | ||
1064 | err = rpcauth_init_credcache(auth); | 1064 | err = rpcauth_init_credcache(auth); |
@@ -1187,7 +1187,7 @@ gss_auth_find_or_add_hashed(const struct rpc_auth_create_args *args, | |||
1187 | if (strcmp(gss_auth->target_name, args->target_name)) | 1187 | if (strcmp(gss_auth->target_name, args->target_name)) |
1188 | continue; | 1188 | continue; |
1189 | } | 1189 | } |
1190 | if (!atomic_inc_not_zero(&gss_auth->rpc_auth.au_count)) | 1190 | if (!refcount_inc_not_zero(&gss_auth->rpc_auth.au_count)) |
1191 | continue; | 1191 | continue; |
1192 | goto out; | 1192 | goto out; |
1193 | } | 1193 | } |
diff --git a/net/sunrpc/auth_null.c b/net/sunrpc/auth_null.c index ea816d7000a4..2694a1bc026b 100644 --- a/net/sunrpc/auth_null.c +++ b/net/sunrpc/auth_null.c | |||
@@ -21,7 +21,7 @@ static struct rpc_cred null_cred; | |||
21 | static struct rpc_auth * | 21 | static struct rpc_auth * |
22 | nul_create(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt) | 22 | nul_create(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt) |
23 | { | 23 | { |
24 | atomic_inc(&null_auth.au_count); | 24 | refcount_inc(&null_auth.au_count); |
25 | return &null_auth; | 25 | return &null_auth; |
26 | } | 26 | } |
27 | 27 | ||
@@ -119,7 +119,7 @@ struct rpc_auth null_auth = { | |||
119 | .au_flags = RPCAUTH_AUTH_NO_CRKEY_TIMEOUT, | 119 | .au_flags = RPCAUTH_AUTH_NO_CRKEY_TIMEOUT, |
120 | .au_ops = &authnull_ops, | 120 | .au_ops = &authnull_ops, |
121 | .au_flavor = RPC_AUTH_NULL, | 121 | .au_flavor = RPC_AUTH_NULL, |
122 | .au_count = ATOMIC_INIT(0), | 122 | .au_count = REFCOUNT_INIT(1), |
123 | }; | 123 | }; |
124 | 124 | ||
125 | static | 125 | static |
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c index 185e56d4f9ae..4c1c7e56288f 100644 --- a/net/sunrpc/auth_unix.c +++ b/net/sunrpc/auth_unix.c | |||
@@ -34,7 +34,7 @@ unx_create(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt) | |||
34 | { | 34 | { |
35 | dprintk("RPC: creating UNIX authenticator for client %p\n", | 35 | dprintk("RPC: creating UNIX authenticator for client %p\n", |
36 | clnt); | 36 | clnt); |
37 | atomic_inc(&unix_auth.au_count); | 37 | refcount_inc(&unix_auth.au_count); |
38 | return &unix_auth; | 38 | return &unix_auth; |
39 | } | 39 | } |
40 | 40 | ||
@@ -239,7 +239,7 @@ struct rpc_auth unix_auth = { | |||
239 | .au_flags = RPCAUTH_AUTH_NO_CRKEY_TIMEOUT, | 239 | .au_flags = RPCAUTH_AUTH_NO_CRKEY_TIMEOUT, |
240 | .au_ops = &authunix_ops, | 240 | .au_ops = &authunix_ops, |
241 | .au_flavor = RPC_AUTH_UNIX, | 241 | .au_flavor = RPC_AUTH_UNIX, |
242 | .au_count = ATOMIC_INIT(0), | 242 | .au_count = REFCOUNT_INIT(1), |
243 | }; | 243 | }; |
244 | 244 | ||
245 | static | 245 | static |