aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2014-07-13 21:28:20 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-08-03 17:14:12 -0400
commitbd95608053b7f7813351b0defc0e3e7ef8cf2803 (patch)
treefde08b1ecc2c4aedd30a68244ca502ce5f81f0fe /include
parentd51ac1a8e9b86b2d17d349bb256869cab6522787 (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')
-rw-r--r--include/linux/sunrpc/auth.h2
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);
154void rpc_destroy_authunix(void); 155void rpc_destroy_authunix(void);
155 156
156struct rpc_cred * rpc_lookup_cred(void); 157struct rpc_cred * rpc_lookup_cred(void);
158struct rpc_cred * rpc_lookup_cred_nonblock(void);
157struct rpc_cred * rpc_lookup_machine_cred(const char *service_name); 159struct rpc_cred * rpc_lookup_machine_cred(const char *service_name);
158int rpcauth_register(const struct rpc_authops *); 160int rpcauth_register(const struct rpc_authops *);
159int rpcauth_unregister(const struct rpc_authops *); 161int rpcauth_unregister(const struct rpc_authops *);