aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-12-23 15:21:31 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-12-23 15:21:31 -0500
commit88a9fe8cae3bb52e82489447f45e8d7ba1409ca8 (patch)
treeacef9d0b7d4c8c2e98faf852ab8bc0173842fbe5
parent136221fc3219b3805c48db5da065e8e3467175d4 (diff)
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>
-rw-r--r--include/linux/sunrpc/xdr.h15
-rw-r--r--net/sunrpc/auth.c4
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c10
3 files changed, 7 insertions, 22 deletions
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index e4057d729f03..49e1eb454465 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -37,21 +37,6 @@ struct xdr_netobj {
37typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj); 37typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj);
38 38
39/* 39/*
40 * We're still requiring the BKL in the xdr code until it's been
41 * more carefully audited, at which point this wrapper will become
42 * unnecessary.
43 */
44static inline int rpc_call_xdrproc(kxdrproc_t xdrproc, void *rqstp, __be32 *data, void *obj)
45{
46 int ret;
47
48 lock_kernel();
49 ret = xdrproc(rqstp, data, obj);
50 unlock_kernel();
51 return ret;
52}
53
54/*
55 * Basic structure for transmission/reception of a client XDR message. 40 * Basic structure for transmission/reception of a client XDR message.
56 * Features a header (for a linear buffer containing RPC headers 41 * Features a header (for a linear buffer containing RPC headers
57 * and the data payload for short messages), and then an array of 42 * and the data payload for short messages), and then an array of
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index cb216b2df666..6e28744b1709 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -513,7 +513,7 @@ rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp,
513 if (cred->cr_ops->crwrap_req) 513 if (cred->cr_ops->crwrap_req)
514 return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj); 514 return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj);
515 /* By default, we encode the arguments normally. */ 515 /* By default, we encode the arguments normally. */
516 return rpc_call_xdrproc(encode, rqstp, data, obj); 516 return encode(rqstp, data, obj);
517} 517}
518 518
519int 519int
@@ -528,7 +528,7 @@ rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp,
528 return cred->cr_ops->crunwrap_resp(task, decode, rqstp, 528 return cred->cr_ops->crunwrap_resp(task, decode, rqstp,
529 data, obj); 529 data, obj);
530 /* By default, we decode the arguments normally. */ 530 /* By default, we decode the arguments normally. */
531 return rpc_call_xdrproc(decode, rqstp, data, obj); 531 return decode(rqstp, data, obj);
532} 532}
533 533
534int 534int
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 853a4142cea1..b8561597f0c8 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -1017,7 +1017,7 @@ gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
1017 offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base; 1017 offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base;
1018 *p++ = htonl(rqstp->rq_seqno); 1018 *p++ = htonl(rqstp->rq_seqno);
1019 1019
1020 status = rpc_call_xdrproc(encode, rqstp, p, obj); 1020 status = encode(rqstp, p, obj);
1021 if (status) 1021 if (status)
1022 return status; 1022 return status;
1023 1023
@@ -1111,7 +1111,7 @@ gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
1111 offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base; 1111 offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base;
1112 *p++ = htonl(rqstp->rq_seqno); 1112 *p++ = htonl(rqstp->rq_seqno);
1113 1113
1114 status = rpc_call_xdrproc(encode, rqstp, p, obj); 1114 status = encode(rqstp, p, obj);
1115 if (status) 1115 if (status)
1116 return status; 1116 return status;
1117 1117
@@ -1170,12 +1170,12 @@ gss_wrap_req(struct rpc_task *task,
1170 /* The spec seems a little ambiguous here, but I think that not 1170 /* The spec seems a little ambiguous here, but I think that not
1171 * wrapping context destruction requests makes the most sense. 1171 * wrapping context destruction requests makes the most sense.
1172 */ 1172 */
1173 status = rpc_call_xdrproc(encode, rqstp, p, obj); 1173 status = encode(rqstp, p, obj);
1174 goto out; 1174 goto out;
1175 } 1175 }
1176 switch (gss_cred->gc_service) { 1176 switch (gss_cred->gc_service) {
1177 case RPC_GSS_SVC_NONE: 1177 case RPC_GSS_SVC_NONE:
1178 status = rpc_call_xdrproc(encode, rqstp, p, obj); 1178 status = encode(rqstp, p, obj);
1179 break; 1179 break;
1180 case RPC_GSS_SVC_INTEGRITY: 1180 case RPC_GSS_SVC_INTEGRITY:
1181 status = gss_wrap_req_integ(cred, ctx, encode, 1181 status = gss_wrap_req_integ(cred, ctx, encode,
@@ -1291,7 +1291,7 @@ gss_unwrap_resp(struct rpc_task *task,
1291 cred->cr_auth->au_rslack = cred->cr_auth->au_verfsize + (p - savedp) 1291 cred->cr_auth->au_rslack = cred->cr_auth->au_verfsize + (p - savedp)
1292 + (savedlen - head->iov_len); 1292 + (savedlen - head->iov_len);
1293out_decode: 1293out_decode:
1294 status = rpc_call_xdrproc(decode, rqstp, p, obj); 1294 status = decode(rqstp, p, obj);
1295out: 1295out:
1296 gss_put_ctx(ctx); 1296 gss_put_ctx(ctx);
1297 dprintk("RPC: %5u gss_unwrap_resp returning %d\n", task->tk_pid, 1297 dprintk("RPC: %5u gss_unwrap_resp returning %d\n", task->tk_pid,