提交 1be27f36 编写于 作者: T Trond Myklebust

SUNRPC: Remove the tk_auth macro...

We should almost always be deferencing the rpc_auth struct by means of the
credential's cr_auth field instead of the rpc_clnt->cl_auth anyway. Fix up
that historical mistake, and remove the macro that propagated it.
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 1dd17ec6
...@@ -223,7 +223,7 @@ nfs_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs_diropargs *args) ...@@ -223,7 +223,7 @@ nfs_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs_diropargs *args)
static int static int
nfs_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args) nfs_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
{ {
struct rpc_auth *auth = req->rq_task->tk_auth; struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
unsigned int replen; unsigned int replen;
u32 offset = (u32)args->offset; u32 offset = (u32)args->offset;
u32 count = args->count; u32 count = args->count;
...@@ -380,7 +380,7 @@ static int ...@@ -380,7 +380,7 @@ static int
nfs_xdr_readdirargs(struct rpc_rqst *req, __be32 *p, struct nfs_readdirargs *args) nfs_xdr_readdirargs(struct rpc_rqst *req, __be32 *p, struct nfs_readdirargs *args)
{ {
struct rpc_task *task = req->rq_task; struct rpc_task *task = req->rq_task;
struct rpc_auth *auth = task->tk_auth; struct rpc_auth *auth = task->tk_msg.rpc_cred->cr_auth;
unsigned int replen; unsigned int replen;
u32 count = args->count; u32 count = args->count;
...@@ -541,7 +541,7 @@ nfs_xdr_diropres(struct rpc_rqst *req, __be32 *p, struct nfs_diropok *res) ...@@ -541,7 +541,7 @@ nfs_xdr_diropres(struct rpc_rqst *req, __be32 *p, struct nfs_diropok *res)
static int static int
nfs_xdr_readlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs_readlinkargs *args) nfs_xdr_readlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs_readlinkargs *args)
{ {
struct rpc_auth *auth = req->rq_task->tk_auth; struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
unsigned int replen; unsigned int replen;
p = xdr_encode_fhandle(p, args->fh); p = xdr_encode_fhandle(p, args->fh);
......
...@@ -319,7 +319,7 @@ nfs3_xdr_accessargs(struct rpc_rqst *req, __be32 *p, struct nfs3_accessargs *arg ...@@ -319,7 +319,7 @@ nfs3_xdr_accessargs(struct rpc_rqst *req, __be32 *p, struct nfs3_accessargs *arg
static int static int
nfs3_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args) nfs3_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
{ {
struct rpc_auth *auth = req->rq_task->tk_auth; struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
unsigned int replen; unsigned int replen;
u32 count = args->count; u32 count = args->count;
...@@ -458,7 +458,7 @@ nfs3_xdr_linkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_linkargs *args) ...@@ -458,7 +458,7 @@ nfs3_xdr_linkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_linkargs *args)
static int static int
nfs3_xdr_readdirargs(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirargs *args) nfs3_xdr_readdirargs(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirargs *args)
{ {
struct rpc_auth *auth = req->rq_task->tk_auth; struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
unsigned int replen; unsigned int replen;
u32 count = args->count; u32 count = args->count;
...@@ -643,7 +643,7 @@ static int ...@@ -643,7 +643,7 @@ static int
nfs3_xdr_getaclargs(struct rpc_rqst *req, __be32 *p, nfs3_xdr_getaclargs(struct rpc_rqst *req, __be32 *p,
struct nfs3_getaclargs *args) struct nfs3_getaclargs *args)
{ {
struct rpc_auth *auth = req->rq_task->tk_auth; struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
unsigned int replen; unsigned int replen;
p = xdr_encode_fhandle(p, args->fh); p = xdr_encode_fhandle(p, args->fh);
...@@ -773,7 +773,7 @@ nfs3_xdr_accessres(struct rpc_rqst *req, __be32 *p, struct nfs3_accessres *res) ...@@ -773,7 +773,7 @@ nfs3_xdr_accessres(struct rpc_rqst *req, __be32 *p, struct nfs3_accessres *res)
static int static int
nfs3_xdr_readlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_readlinkargs *args) nfs3_xdr_readlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_readlinkargs *args)
{ {
struct rpc_auth *auth = req->rq_task->tk_auth; struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
unsigned int replen; unsigned int replen;
p = xdr_encode_fhandle(p, args->fh); p = xdr_encode_fhandle(p, args->fh);
......
...@@ -1071,7 +1071,7 @@ static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args) ...@@ -1071,7 +1071,7 @@ static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args)
static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req) static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req)
{ {
struct rpc_auth *auth = req->rq_task->tk_auth; struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
uint32_t attrs[2] = { uint32_t attrs[2] = {
FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID, FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID,
FATTR4_WORD1_MOUNTED_ON_FILEID, FATTR4_WORD1_MOUNTED_ON_FILEID,
...@@ -1117,7 +1117,7 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg ...@@ -1117,7 +1117,7 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *readlink, struct rpc_rqst *req) static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *readlink, struct rpc_rqst *req)
{ {
struct rpc_auth *auth = req->rq_task->tk_auth; struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
unsigned int replen; unsigned int replen;
__be32 *p; __be32 *p;
...@@ -1735,7 +1735,7 @@ static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nf ...@@ -1735,7 +1735,7 @@ static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nf
*/ */
static int nfs4_xdr_enc_read(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args) static int nfs4_xdr_enc_read(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
{ {
struct rpc_auth *auth = req->rq_task->tk_auth; struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
struct xdr_stream xdr; struct xdr_stream xdr;
struct compound_hdr hdr = { struct compound_hdr hdr = {
.nops = 2, .nops = 2,
...@@ -1795,7 +1795,7 @@ nfs4_xdr_enc_getacl(struct rpc_rqst *req, __be32 *p, ...@@ -1795,7 +1795,7 @@ nfs4_xdr_enc_getacl(struct rpc_rqst *req, __be32 *p,
struct nfs_getaclargs *args) struct nfs_getaclargs *args)
{ {
struct xdr_stream xdr; struct xdr_stream xdr;
struct rpc_auth *auth = req->rq_task->tk_auth; struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
struct compound_hdr hdr = { struct compound_hdr hdr = {
.nops = 2, .nops = 2,
}; };
...@@ -2030,7 +2030,7 @@ static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs ...@@ -2030,7 +2030,7 @@ static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs
struct compound_hdr hdr = { struct compound_hdr hdr = {
.nops = 3, .nops = 3,
}; };
struct rpc_auth *auth = req->rq_task->tk_auth; struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
int replen; int replen;
int status; int status;
......
...@@ -98,7 +98,6 @@ struct rpc_task { ...@@ -98,7 +98,6 @@ struct rpc_task {
unsigned short tk_pid; /* debugging aid */ unsigned short tk_pid; /* debugging aid */
#endif #endif
}; };
#define tk_auth tk_client->cl_auth
#define tk_xprt tk_client->cl_xprt #define tk_xprt tk_client->cl_xprt
/* support walking a list of tasks on a wait queue */ /* support walking a list of tasks on a wait queue */
......
...@@ -371,7 +371,7 @@ EXPORT_SYMBOL(rpcauth_init_cred); ...@@ -371,7 +371,7 @@ EXPORT_SYMBOL(rpcauth_init_cred);
struct rpc_cred * struct rpc_cred *
rpcauth_bindcred(struct rpc_task *task) rpcauth_bindcred(struct rpc_task *task)
{ {
struct rpc_auth *auth = task->tk_auth; struct rpc_auth *auth = task->tk_client->cl_auth;
struct auth_cred acred = { struct auth_cred acred = {
.uid = current->fsuid, .uid = current->fsuid,
.gid = current->fsgid, .gid = current->fsgid,
...@@ -381,7 +381,7 @@ rpcauth_bindcred(struct rpc_task *task) ...@@ -381,7 +381,7 @@ rpcauth_bindcred(struct rpc_task *task)
int flags = 0; int flags = 0;
dprintk("RPC: %5u looking up %s cred\n", dprintk("RPC: %5u looking up %s cred\n",
task->tk_pid, task->tk_auth->au_ops->au_name); task->tk_pid, task->tk_client->cl_auth->au_ops->au_name);
get_group_info(acred.group_info); get_group_info(acred.group_info);
if (task->tk_flags & RPC_TASK_ROOTCREDS) if (task->tk_flags & RPC_TASK_ROOTCREDS)
flags |= RPCAUTH_LOOKUP_ROOTCREDS; flags |= RPCAUTH_LOOKUP_ROOTCREDS;
...@@ -397,11 +397,12 @@ rpcauth_bindcred(struct rpc_task *task) ...@@ -397,11 +397,12 @@ rpcauth_bindcred(struct rpc_task *task)
void void
rpcauth_holdcred(struct rpc_task *task) rpcauth_holdcred(struct rpc_task *task)
{ {
dprintk("RPC: %5u holding %s cred %p\n", struct rpc_cred *cred = task->tk_msg.rpc_cred;
task->tk_pid, task->tk_auth->au_ops->au_name, if (cred != NULL) {
task->tk_msg.rpc_cred); get_rpccred(cred);
if (task->tk_msg.rpc_cred) dprintk("RPC: %5u holding %s cred %p\n", task->tk_pid,
get_rpccred(task->tk_msg.rpc_cred); cred->cr_auth->au_ops->au_name, cred);
}
} }
void void
...@@ -441,7 +442,7 @@ rpcauth_unbindcred(struct rpc_task *task) ...@@ -441,7 +442,7 @@ rpcauth_unbindcred(struct rpc_task *task)
struct rpc_cred *cred = task->tk_msg.rpc_cred; struct rpc_cred *cred = task->tk_msg.rpc_cred;
dprintk("RPC: %5u releasing %s cred %p\n", dprintk("RPC: %5u releasing %s cred %p\n",
task->tk_pid, task->tk_auth->au_ops->au_name, cred); task->tk_pid, cred->cr_auth->au_ops->au_name, cred);
put_rpccred(cred); put_rpccred(cred);
task->tk_msg.rpc_cred = NULL; task->tk_msg.rpc_cred = NULL;
...@@ -453,7 +454,7 @@ rpcauth_marshcred(struct rpc_task *task, __be32 *p) ...@@ -453,7 +454,7 @@ rpcauth_marshcred(struct rpc_task *task, __be32 *p)
struct rpc_cred *cred = task->tk_msg.rpc_cred; struct rpc_cred *cred = task->tk_msg.rpc_cred;
dprintk("RPC: %5u marshaling %s cred %p\n", dprintk("RPC: %5u marshaling %s cred %p\n",
task->tk_pid, task->tk_auth->au_ops->au_name, cred); task->tk_pid, cred->cr_auth->au_ops->au_name, cred);
return cred->cr_ops->crmarshal(task, p); return cred->cr_ops->crmarshal(task, p);
} }
...@@ -464,7 +465,7 @@ rpcauth_checkverf(struct rpc_task *task, __be32 *p) ...@@ -464,7 +465,7 @@ rpcauth_checkverf(struct rpc_task *task, __be32 *p)
struct rpc_cred *cred = task->tk_msg.rpc_cred; struct rpc_cred *cred = task->tk_msg.rpc_cred;
dprintk("RPC: %5u validating %s cred %p\n", dprintk("RPC: %5u validating %s cred %p\n",
task->tk_pid, task->tk_auth->au_ops->au_name, cred); task->tk_pid, cred->cr_auth->au_ops->au_name, cred);
return cred->cr_ops->crvalidate(task, p); return cred->cr_ops->crvalidate(task, p);
} }
...@@ -505,7 +506,7 @@ rpcauth_refreshcred(struct rpc_task *task) ...@@ -505,7 +506,7 @@ rpcauth_refreshcred(struct rpc_task *task)
int err; int err;
dprintk("RPC: %5u refreshing %s cred %p\n", dprintk("RPC: %5u refreshing %s cred %p\n",
task->tk_pid, task->tk_auth->au_ops->au_name, cred); task->tk_pid, cred->cr_auth->au_ops->au_name, cred);
err = cred->cr_ops->crrefresh(task); err = cred->cr_ops->crrefresh(task);
if (err < 0) if (err < 0)
...@@ -519,7 +520,7 @@ rpcauth_invalcred(struct rpc_task *task) ...@@ -519,7 +520,7 @@ rpcauth_invalcred(struct rpc_task *task)
struct rpc_cred *cred = task->tk_msg.rpc_cred; struct rpc_cred *cred = task->tk_msg.rpc_cred;
dprintk("RPC: %5u invalidating %s cred %p\n", dprintk("RPC: %5u invalidating %s cred %p\n",
task->tk_pid, task->tk_auth->au_ops->au_name, cred); task->tk_pid, cred->cr_auth->au_ops->au_name, cred);
if (cred) if (cred)
clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags); clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
} }
......
...@@ -906,7 +906,7 @@ gss_validate(struct rpc_task *task, __be32 *p) ...@@ -906,7 +906,7 @@ gss_validate(struct rpc_task *task, __be32 *p)
goto out_bad; goto out_bad;
/* We leave it to unwrap to calculate au_rslack. For now we just /* We leave it to unwrap to calculate au_rslack. For now we just
* calculate the length of the verifier: */ * calculate the length of the verifier: */
task->tk_auth->au_verfsize = XDR_QUADLEN(len) + 2; cred->cr_auth->au_verfsize = XDR_QUADLEN(len) + 2;
gss_put_ctx(ctx); gss_put_ctx(ctx);
dprintk("RPC: %5u gss_validate: gss_verify_mic succeeded.\n", dprintk("RPC: %5u gss_validate: gss_verify_mic succeeded.\n",
task->tk_pid); task->tk_pid);
...@@ -1206,7 +1206,7 @@ gss_unwrap_resp(struct rpc_task *task, ...@@ -1206,7 +1206,7 @@ gss_unwrap_resp(struct rpc_task *task,
break; break;
} }
/* take into account extra slack for integrity and privacy cases: */ /* take into account extra slack for integrity and privacy cases: */
task->tk_auth->au_rslack = task->tk_auth->au_verfsize + (p - savedp) cred->cr_auth->au_rslack = cred->cr_auth->au_verfsize + (p - savedp)
+ (savedlen - head->iov_len); + (savedlen - head->iov_len);
out_decode: out_decode:
status = decode(rqstp, p, obj); status = decode(rqstp, p, obj);
......
...@@ -204,7 +204,7 @@ unx_validate(struct rpc_task *task, __be32 *p) ...@@ -204,7 +204,7 @@ unx_validate(struct rpc_task *task, __be32 *p)
printk("RPC: giant verf size: %u\n", size); printk("RPC: giant verf size: %u\n", size);
return NULL; return NULL;
} }
task->tk_auth->au_rslack = (size >> 2) + 2; task->tk_msg.rpc_cred->cr_auth->au_rslack = (size >> 2) + 2;
p += (size >> 2); p += (size >> 2);
return p; return p;
......
...@@ -787,7 +787,7 @@ call_reserveresult(struct rpc_task *task) ...@@ -787,7 +787,7 @@ call_reserveresult(struct rpc_task *task)
static void static void
call_allocate(struct rpc_task *task) call_allocate(struct rpc_task *task)
{ {
unsigned int slack = task->tk_auth->au_cslack; unsigned int slack = task->tk_msg.rpc_cred->cr_auth->au_cslack;
struct rpc_rqst *req = task->tk_rqstp; struct rpc_rqst *req = task->tk_rqstp;
struct rpc_xprt *xprt = task->tk_xprt; struct rpc_xprt *xprt = task->tk_xprt;
struct rpc_procinfo *proc = task->tk_msg.rpc_proc; struct rpc_procinfo *proc = task->tk_msg.rpc_proc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册