diff options
author | NeilBrown <neilb@suse.de> | 2014-07-13 21:28:20 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-08-03 17:14:12 -0400 |
commit | bd95608053b7f7813351b0defc0e3e7ef8cf2803 (patch) | |
tree | fde08b1ecc2c4aedd30a68244ca502ce5f81f0fe /include/linux | |
parent | d51ac1a8e9b86b2d17d349bb256869cab6522787 (diff) |
sunrpc/auth: allow lockless (rcu) lookup of credential cache.
The new flag RPCAUTH_LOOKUP_RCU to credential lookup avoids locking,
does not take a reference on the returned credential, and returns
-ECHILD if a simple lookup was not possible.
The returned value can only be used within an rcu_read_lock protected
region.
The main user of this is the new rpc_lookup_cred_nonblock() which
returns a pointer to the current credential which is only rcu-safe (no
ref-count held), and might return -ECHILD if allocation was required.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/sunrpc/auth.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index c683b9a06913..8e030075fe79 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h | |||
@@ -103,6 +103,7 @@ struct rpc_auth_create_args { | |||
103 | 103 | ||
104 | /* Flags for rpcauth_lookupcred() */ | 104 | /* Flags for rpcauth_lookupcred() */ |
105 | #define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */ | 105 | #define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */ |
106 | #define RPCAUTH_LOOKUP_RCU 0x02 /* lock-less lookup */ | ||
106 | 107 | ||
107 | /* | 108 | /* |
108 | * Client authentication ops | 109 | * Client authentication ops |
@@ -154,6 +155,7 @@ void rpc_destroy_generic_auth(void); | |||
154 | void rpc_destroy_authunix(void); | 155 | void rpc_destroy_authunix(void); |
155 | 156 | ||
156 | struct rpc_cred * rpc_lookup_cred(void); | 157 | struct rpc_cred * rpc_lookup_cred(void); |
158 | struct rpc_cred * rpc_lookup_cred_nonblock(void); | ||
157 | struct rpc_cred * rpc_lookup_machine_cred(const char *service_name); | 159 | struct rpc_cred * rpc_lookup_machine_cred(const char *service_name); |
158 | int rpcauth_register(const struct rpc_authops *); | 160 | int rpcauth_register(const struct rpc_authops *); |
159 | int rpcauth_unregister(const struct rpc_authops *); | 161 | int rpcauth_unregister(const struct rpc_authops *); |