diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2012-09-14 17:24:02 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-10-01 18:33:33 -0400 |
commit | ba9b584c1dc37851d9c6ca6d0d2ccba55d9aad04 (patch) | |
tree | d74fa5a04f928d5c508594f285381b41bfe4ac3c /include/linux/sunrpc/clnt.h | |
parent | 1b63a75180c6c65c71655c250a4e6b578ba7d1c0 (diff) |
SUNRPC: Introduce rpc_clone_client_set_auth()
An ULP is supposed to be able to replace a GSS rpc_auth object with
another GSS rpc_auth object using rpcauth_create(). However,
rpcauth_create() in 3.5 reliably fails with -EEXIST in this case.
This is because when gss_create() attempts to create the upcall pipes,
sometimes they are already there. For example if a pipe FS mount
event occurs, or a previous GSS flavor was in use for this rpc_clnt.
It turns out that's not the only problem here. While working on a
fix for the above problem, we noticed that replacing an rpc_clnt's
rpc_auth is not safe, since dereferencing the cl_auth field is not
protected in any way.
So we're deprecating the ability of rpcauth_create() to switch an
rpc_clnt's security flavor during normal operation. Instead, let's
add a fresh API that clones an rpc_clnt and gives the clone a new
flavor before it's used.
This makes immediate use of the new __rpc_clone_client() helper.
This can be used in a similar fashion to rpcauth_create() when a
client is hunting for the correct security flavor. Instead of
replacing an rpc_clnt's security flavor in a loop, the ULP replaces
the whole rpc_clnt.
To fix the -EEXIST problem, any ULP logic that relies on replacing
an rpc_clnt's rpc_auth with rpcauth_create() must be changed to use
this API instead.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'include/linux/sunrpc/clnt.h')
-rw-r--r-- | include/linux/sunrpc/clnt.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 523547ecfee2..34206b84d8da 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -130,6 +130,8 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, | |||
130 | const struct rpc_program *, u32); | 130 | const struct rpc_program *, u32); |
131 | void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt); | 131 | void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt); |
132 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); | 132 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); |
133 | struct rpc_clnt *rpc_clone_client_set_auth(struct rpc_clnt *, | ||
134 | rpc_authflavor_t); | ||
133 | void rpc_shutdown_client(struct rpc_clnt *); | 135 | void rpc_shutdown_client(struct rpc_clnt *); |
134 | void rpc_release_client(struct rpc_clnt *); | 136 | void rpc_release_client(struct rpc_clnt *); |
135 | void rpc_task_release_client(struct rpc_task *); | 137 | void rpc_task_release_client(struct rpc_task *); |