Commit cf6dd6f2 authored by Trond Myklebust's avatar Trond Myklebust

RPC: struct rpc_auth initialization and destruction code cleanup

 Move the initialization of auth->au_count into the flavour-specific code.
 Move the kfree(auth) into the flavour-specific code.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 7b13d547
......@@ -70,7 +70,6 @@ rpcauth_create(rpc_authflavor_t pseudoflavor, struct rpc_clnt *clnt)
auth = ops->create(clnt, pseudoflavor);
if (!auth)
return NULL;
atomic_set(&auth->au_count, 1);
if (clnt->cl_auth)
rpcauth_destroy(clnt->cl_auth);
clnt->cl_auth = auth;
......@@ -83,7 +82,6 @@ rpcauth_destroy(struct rpc_auth *auth)
if (!atomic_dec_and_test(&auth->au_count))
return;
auth->au_ops->destroy(auth);
kfree(auth);
}
static DEFINE_SPINLOCK(rpc_credcache_lock);
......
......@@ -584,6 +584,7 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
auth->au_expire = GSS_CRED_EXPIRE;
auth->au_ops = &authgss_ops;
auth->au_flavor = flavor;
atomic_set(&auth->au_count, 1);
rpcauth_init_credcache(auth);
......@@ -617,6 +618,7 @@ gss_destroy(struct rpc_auth *auth)
gss_mech_put(gss_auth->mech);
rpcauth_free_credcache(auth);
kfree(gss_auth);
module_put(THIS_MODULE);
}
......
......@@ -32,6 +32,7 @@ nul_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
auth->au_rslack = 2;
auth->au_ops = &authnull_ops;
auth->au_expire = 1800 * HZ;
atomic_set(&auth->au_count, 1);
rpcauth_init_credcache(auth);
return (struct rpc_auth *) auth;
......@@ -42,6 +43,7 @@ nul_destroy(struct rpc_auth *auth)
{
dprintk("RPC: destroying NULL authenticator %p\n", auth);
rpcauth_free_credcache(auth);
kfree(auth);
}
/*
......
......@@ -50,6 +50,7 @@ unx_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
auth->au_rslack = 2; /* assume AUTH_NULL verf */
auth->au_expire = UNX_CRED_EXPIRE;
auth->au_ops = &authunix_ops;
atomic_set(&auth->au_count, 1);
rpcauth_init_credcache(auth);
......@@ -61,6 +62,7 @@ unx_destroy(struct rpc_auth *auth)
{
dprintk("RPC: destroying UNIX authenticator %p\n", auth);
rpcauth_free_credcache(auth);
kfree(auth);
}
static struct rpc_cred *
......
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