SUNRPC: Remove the last remnant of the BKL...
Somehow, this escaped the previous purge. There should be no need to keep any extra locks in the XDR callbacks. The NFS client XDR code only writes into private objects, whereas all reads of shared objects are confined to fields that do not change, such as filehandles... Ditto for lockd, the NFSv2/v3 client mount code, and rpcbind. The nfsd XDR code may require the BKL, but since it does a synchronous RPC call from a thread that already holds the lock, that issue is moot. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Родитель
136221fc32
Коммит
88a9fe8cae
|
@ -36,21 +36,6 @@ struct xdr_netobj {
|
||||||
*/
|
*/
|
||||||
typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj);
|
typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj);
|
||||||
|
|
||||||
/*
|
|
||||||
* We're still requiring the BKL in the xdr code until it's been
|
|
||||||
* more carefully audited, at which point this wrapper will become
|
|
||||||
* unnecessary.
|
|
||||||
*/
|
|
||||||
static inline int rpc_call_xdrproc(kxdrproc_t xdrproc, void *rqstp, __be32 *data, void *obj)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
lock_kernel();
|
|
||||||
ret = xdrproc(rqstp, data, obj);
|
|
||||||
unlock_kernel();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Basic structure for transmission/reception of a client XDR message.
|
* Basic structure for transmission/reception of a client XDR message.
|
||||||
* Features a header (for a linear buffer containing RPC headers
|
* Features a header (for a linear buffer containing RPC headers
|
||||||
|
|
|
@ -513,7 +513,7 @@ rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp,
|
||||||
if (cred->cr_ops->crwrap_req)
|
if (cred->cr_ops->crwrap_req)
|
||||||
return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj);
|
return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj);
|
||||||
/* By default, we encode the arguments normally. */
|
/* By default, we encode the arguments normally. */
|
||||||
return rpc_call_xdrproc(encode, rqstp, data, obj);
|
return encode(rqstp, data, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -528,7 +528,7 @@ rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp,
|
||||||
return cred->cr_ops->crunwrap_resp(task, decode, rqstp,
|
return cred->cr_ops->crunwrap_resp(task, decode, rqstp,
|
||||||
data, obj);
|
data, obj);
|
||||||
/* By default, we decode the arguments normally. */
|
/* By default, we decode the arguments normally. */
|
||||||
return rpc_call_xdrproc(decode, rqstp, data, obj);
|
return decode(rqstp, data, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -1017,7 +1017,7 @@ gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
|
||||||
offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base;
|
offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base;
|
||||||
*p++ = htonl(rqstp->rq_seqno);
|
*p++ = htonl(rqstp->rq_seqno);
|
||||||
|
|
||||||
status = rpc_call_xdrproc(encode, rqstp, p, obj);
|
status = encode(rqstp, p, obj);
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
@ -1111,7 +1111,7 @@ gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
|
||||||
offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base;
|
offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base;
|
||||||
*p++ = htonl(rqstp->rq_seqno);
|
*p++ = htonl(rqstp->rq_seqno);
|
||||||
|
|
||||||
status = rpc_call_xdrproc(encode, rqstp, p, obj);
|
status = encode(rqstp, p, obj);
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
@ -1170,12 +1170,12 @@ gss_wrap_req(struct rpc_task *task,
|
||||||
/* The spec seems a little ambiguous here, but I think that not
|
/* The spec seems a little ambiguous here, but I think that not
|
||||||
* wrapping context destruction requests makes the most sense.
|
* wrapping context destruction requests makes the most sense.
|
||||||
*/
|
*/
|
||||||
status = rpc_call_xdrproc(encode, rqstp, p, obj);
|
status = encode(rqstp, p, obj);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
switch (gss_cred->gc_service) {
|
switch (gss_cred->gc_service) {
|
||||||
case RPC_GSS_SVC_NONE:
|
case RPC_GSS_SVC_NONE:
|
||||||
status = rpc_call_xdrproc(encode, rqstp, p, obj);
|
status = encode(rqstp, p, obj);
|
||||||
break;
|
break;
|
||||||
case RPC_GSS_SVC_INTEGRITY:
|
case RPC_GSS_SVC_INTEGRITY:
|
||||||
status = gss_wrap_req_integ(cred, ctx, encode,
|
status = gss_wrap_req_integ(cred, ctx, encode,
|
||||||
|
@ -1291,7 +1291,7 @@ gss_unwrap_resp(struct rpc_task *task,
|
||||||
cred->cr_auth->au_rslack = cred->cr_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 = rpc_call_xdrproc(decode, rqstp, p, obj);
|
status = decode(rqstp, p, obj);
|
||||||
out:
|
out:
|
||||||
gss_put_ctx(ctx);
|
gss_put_ctx(ctx);
|
||||||
dprintk("RPC: %5u gss_unwrap_resp returning %d\n", task->tk_pid,
|
dprintk("RPC: %5u gss_unwrap_resp returning %d\n", task->tk_pid,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче