From: Andy Adamson Date: Fri, 18 May 2007 16:52:42 -0400 NFSv4: Obtain an RPC credential for NFS4ERR_WRONGSEC handler Helper function for WRONGSEC handler Signed-off-by: Andy Adamson Signed-off-by: Trond Myklebust --- fs/nfs/client.c | 21 +++++++++++++++++++++ fs/nfs/nfs4_fs.h | 2 ++ 2 files changed, 23 insertions(+), 0 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index eb03f5f..ec7290c 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -1131,6 +1131,27 @@ out: return ret; } +static int nfs4_set_ex_cred(struct nfs4_exception *exc, rpc_authflavor_t flavor) +{ + struct rpc_auth *auth; + int error = 0; + + dprintk("--> nfs4_set_ex_cred: flavor %d\n", flavor); + + auth = rpcauth_create(flavor, exc->ex_clnt); + if (IS_ERR(auth)) { + dprintk("%s: couldn't create credcache!\n", __FUNCTION__); + return PTR_ERR(auth); + } + exc->ex_cred = rpcauth_lookupcred(exc->ex_clnt->cl_auth, 0); + if (IS_ERR(exc->ex_cred)) { + error = PTR_ERR(exc->ex_cred); + exc->ex_cred = NULL; + } + dprintk("<-- nfs4_set_ex_cred %d\n", error); + return error; +} + #endif /* CONFIG_NFS_V4 */ /* diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 9215b66..e63fb05 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h @@ -144,6 +144,8 @@ struct nfs4_exception { long timeout; int retry; struct nfs4_secinfo_res *ex_list; + struct rpc_clnt *ex_clnt; + struct rpc_cred *ex_cred; }; struct nfs4_state_recovery_ops {