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: Trond Myklebust --- auth.c | 3 --- auth_gss/auth_gss.c | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) Index: linux-2.6.11-rc1/net/sunrpc/auth.c =================================================================== --- linux-2.6.11-rc1.orig/net/sunrpc/auth.c +++ linux-2.6.11-rc1/net/sunrpc/auth.c @@ -67,8 +67,6 @@ rpcauth_create(rpc_authflavor_t pseudofl 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); } Index: linux-2.6.11-rc1/net/sunrpc/auth_gss/auth_gss.c =================================================================== --- linux-2.6.11-rc1.orig/net/sunrpc/auth_gss/auth_gss.c +++ linux-2.6.11-rc1/net/sunrpc/auth_gss/auth_gss.c @@ -569,6 +569,8 @@ gss_create(struct rpc_clnt *clnt, rpc_au 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 @@ err_put_mech: 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