Commit fcc7319e authored by Trond Myklebust's avatar Trond Myklebust

RPC: Remove unnecessary module refcounting

 The sunrpc module itself is referenced by other sources, so only the
 auth_gss credcaches need to increment their module refcount.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent ebd75375
......@@ -67,8 +67,6 @@ rpcauth_create(rpc_authflavor_t pseudoflavor, struct rpc_clnt *clnt)
if (flavor >= RPC_AUTH_MAXFLAVOR || !(ops = auth_flavors[flavor]))
return NULL;
if (!try_module_get(ops->owner))
return NULL;
auth = ops->create(clnt, pseudoflavor);
if (!auth)
return NULL;
......@@ -85,7 +83,6 @@ rpcauth_destroy(struct rpc_auth *auth)
if (!atomic_dec_and_test(&auth->au_count))
return;
auth->au_ops->destroy(auth);
module_put(auth->au_ops->owner);
kfree(auth);
}
......
......@@ -569,6 +569,8 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
dprintk("RPC: creating GSS authenticator for client %p\n",clnt);
if (!try_module_get(THIS_MODULE))
return NULL;
if (!(gss_auth = kmalloc(sizeof(*gss_auth), GFP_KERNEL)))
goto out_dec;
gss_auth->mech = gss_mech_get_by_pseudoflavor(flavor);
......@@ -601,6 +603,7 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
err_free:
kfree(gss_auth);
out_dec:
module_put(THIS_MODULE);
return NULL;
}
......@@ -617,6 +620,7 @@ gss_destroy(struct rpc_auth *auth)
gss_mech_put(gss_auth->mech);
rpcauth_free_credcache(auth);
module_put(THIS_MODULE);
}
/* gss_destroy_cred (and gss_destroy_ctx) are used to clean up after failure
......
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