sunrpc: plumb gfp_t parm into crcreate operation
We need to be able to call the generic_cred creator from different contexts. Add a gfp_t parm to the crcreate operation and to rpcauth_lookup_credcache. For now, we just push the gfp_t parms up one level to the *_lookup_cred functions. Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
06ef26a0e3
commit
3c6e0bc8a1
|
@ -127,7 +127,7 @@ struct rpc_authops {
|
||||||
void (*destroy)(struct rpc_auth *);
|
void (*destroy)(struct rpc_auth *);
|
||||||
|
|
||||||
struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int);
|
struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int);
|
||||||
struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int);
|
struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int, gfp_t);
|
||||||
int (*list_pseudoflavors)(rpc_authflavor_t *, int);
|
int (*list_pseudoflavors)(rpc_authflavor_t *, int);
|
||||||
rpc_authflavor_t (*info2flavor)(struct rpcsec_gss_info *);
|
rpc_authflavor_t (*info2flavor)(struct rpcsec_gss_info *);
|
||||||
int (*flavor2info)(rpc_authflavor_t,
|
int (*flavor2info)(rpc_authflavor_t,
|
||||||
|
@ -178,7 +178,7 @@ rpc_authflavor_t rpcauth_get_pseudoflavor(rpc_authflavor_t,
|
||||||
int rpcauth_get_gssinfo(rpc_authflavor_t,
|
int rpcauth_get_gssinfo(rpc_authflavor_t,
|
||||||
struct rpcsec_gss_info *);
|
struct rpcsec_gss_info *);
|
||||||
int rpcauth_list_flavors(rpc_authflavor_t *, int);
|
int rpcauth_list_flavors(rpc_authflavor_t *, int);
|
||||||
struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int);
|
struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int, gfp_t);
|
||||||
void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *);
|
void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *);
|
||||||
struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int);
|
struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int);
|
||||||
struct rpc_cred * rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *, int);
|
struct rpc_cred * rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *, int);
|
||||||
|
|
|
@ -543,7 +543,7 @@ rpcauth_cache_enforce_limit(void)
|
||||||
*/
|
*/
|
||||||
struct rpc_cred *
|
struct rpc_cred *
|
||||||
rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
|
rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
|
||||||
int flags)
|
int flags, gfp_t gfp)
|
||||||
{
|
{
|
||||||
LIST_HEAD(free);
|
LIST_HEAD(free);
|
||||||
struct rpc_cred_cache *cache = auth->au_credcache;
|
struct rpc_cred_cache *cache = auth->au_credcache;
|
||||||
|
@ -580,7 +580,7 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
|
||||||
if (flags & RPCAUTH_LOOKUP_RCU)
|
if (flags & RPCAUTH_LOOKUP_RCU)
|
||||||
return ERR_PTR(-ECHILD);
|
return ERR_PTR(-ECHILD);
|
||||||
|
|
||||||
new = auth->au_ops->crcreate(auth, acred, flags);
|
new = auth->au_ops->crcreate(auth, acred, flags, gfp);
|
||||||
if (IS_ERR(new)) {
|
if (IS_ERR(new)) {
|
||||||
cred = new;
|
cred = new;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -77,15 +77,15 @@ static struct rpc_cred *generic_bind_cred(struct rpc_task *task,
|
||||||
static struct rpc_cred *
|
static struct rpc_cred *
|
||||||
generic_lookup_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
|
generic_lookup_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
|
||||||
{
|
{
|
||||||
return rpcauth_lookup_credcache(&generic_auth, acred, flags);
|
return rpcauth_lookup_credcache(&generic_auth, acred, flags, GFP_KERNEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct rpc_cred *
|
static struct rpc_cred *
|
||||||
generic_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
|
generic_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags, gfp_t gfp)
|
||||||
{
|
{
|
||||||
struct generic_cred *gcred;
|
struct generic_cred *gcred;
|
||||||
|
|
||||||
gcred = kmalloc(sizeof(*gcred), GFP_KERNEL);
|
gcred = kmalloc(sizeof(*gcred), gfp);
|
||||||
if (gcred == NULL)
|
if (gcred == NULL)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
|
|
|
@ -1299,11 +1299,11 @@ gss_destroy_cred(struct rpc_cred *cred)
|
||||||
static struct rpc_cred *
|
static struct rpc_cred *
|
||||||
gss_lookup_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
|
gss_lookup_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
|
||||||
{
|
{
|
||||||
return rpcauth_lookup_credcache(auth, acred, flags);
|
return rpcauth_lookup_credcache(auth, acred, flags, GFP_NOFS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct rpc_cred *
|
static struct rpc_cred *
|
||||||
gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
|
gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags, gfp_t gfp)
|
||||||
{
|
{
|
||||||
struct gss_auth *gss_auth = container_of(auth, struct gss_auth, rpc_auth);
|
struct gss_auth *gss_auth = container_of(auth, struct gss_auth, rpc_auth);
|
||||||
struct gss_cred *cred = NULL;
|
struct gss_cred *cred = NULL;
|
||||||
|
@ -1313,7 +1313,7 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
|
||||||
__func__, from_kuid(&init_user_ns, acred->uid),
|
__func__, from_kuid(&init_user_ns, acred->uid),
|
||||||
auth->au_flavor);
|
auth->au_flavor);
|
||||||
|
|
||||||
if (!(cred = kzalloc(sizeof(*cred), GFP_NOFS)))
|
if (!(cred = kzalloc(sizeof(*cred), gfp)))
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
rpcauth_init_cred(&cred->gc_base, acred, auth, &gss_credops);
|
rpcauth_init_cred(&cred->gc_base, acred, auth, &gss_credops);
|
||||||
|
|
|
@ -52,11 +52,11 @@ unx_destroy(struct rpc_auth *auth)
|
||||||
static struct rpc_cred *
|
static struct rpc_cred *
|
||||||
unx_lookup_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
|
unx_lookup_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
|
||||||
{
|
{
|
||||||
return rpcauth_lookup_credcache(auth, acred, flags);
|
return rpcauth_lookup_credcache(auth, acred, flags, GFP_NOFS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct rpc_cred *
|
static struct rpc_cred *
|
||||||
unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
|
unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags, gfp_t gfp)
|
||||||
{
|
{
|
||||||
struct unx_cred *cred;
|
struct unx_cred *cred;
|
||||||
unsigned int groups = 0;
|
unsigned int groups = 0;
|
||||||
|
@ -66,7 +66,7 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
|
||||||
from_kuid(&init_user_ns, acred->uid),
|
from_kuid(&init_user_ns, acred->uid),
|
||||||
from_kgid(&init_user_ns, acred->gid));
|
from_kgid(&init_user_ns, acred->gid));
|
||||||
|
|
||||||
if (!(cred = kmalloc(sizeof(*cred), GFP_NOFS)))
|
if (!(cred = kmalloc(sizeof(*cred), gfp)))
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
rpcauth_init_cred(&cred->uc_base, acred, auth, &unix_credops);
|
rpcauth_init_cred(&cred->uc_base, acred, auth, &unix_credops);
|
||||||
|
|
Loading…
Reference in New Issue