aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@fieldses.org>2007-07-10 15:19:26 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-10 23:40:50 -0400
commitd8558f99fbc5ef5d4ae76b893784005056450f82 (patch)
tree993e2460295fcdc83c8f9ad755790aa066cd0f94
parent137d6acaa64afa4cf3d977417424e731ea04705a (diff)
sunrpc: drop BKL around wrap and unwrap
We don't need the BKL when wrapping and unwrapping; and experiments by Avishay Traeger have found that permitting multiple encryption and decryption operations to proceed in parallel can provide significant performance improvements. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Cc: Avishay Traeger <atraeger@cs.sunysb.edu> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--net/sunrpc/auth.c13
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c10
-rw-r--r--net/sunrpc/clnt.c4
3 files changed, 21 insertions, 6 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 74baf87ccff9..aa55d0a03e6f 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -13,6 +13,7 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/sunrpc/clnt.h> 14#include <linux/sunrpc/clnt.h>
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/smp_lock.h>
16 17
17#ifdef RPC_DEBUG 18#ifdef RPC_DEBUG
18# define RPCDBG_FACILITY RPCDBG_AUTH 19# define RPCDBG_FACILITY RPCDBG_AUTH
@@ -475,13 +476,17 @@ rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp,
475 __be32 *data, void *obj) 476 __be32 *data, void *obj)
476{ 477{
477 struct rpc_cred *cred = task->tk_msg.rpc_cred; 478 struct rpc_cred *cred = task->tk_msg.rpc_cred;
479 int ret;
478 480
479 dprintk("RPC: %5u using %s cred %p to wrap rpc data\n", 481 dprintk("RPC: %5u using %s cred %p to wrap rpc data\n",
480 task->tk_pid, cred->cr_ops->cr_name, cred); 482 task->tk_pid, cred->cr_ops->cr_name, cred);
481 if (cred->cr_ops->crwrap_req) 483 if (cred->cr_ops->crwrap_req)
482 return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj); 484 return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj);
483 /* By default, we encode the arguments normally. */ 485 /* By default, we encode the arguments normally. */
484 return encode(rqstp, data, obj); 486 lock_kernel();
487 ret = encode(rqstp, data, obj);
488 unlock_kernel();
489 return ret;
485} 490}
486 491
487int 492int
@@ -489,6 +494,7 @@ rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp,
489 __be32 *data, void *obj) 494 __be32 *data, void *obj)
490{ 495{
491 struct rpc_cred *cred = task->tk_msg.rpc_cred; 496 struct rpc_cred *cred = task->tk_msg.rpc_cred;
497 int ret;
492 498
493 dprintk("RPC: %5u using %s cred %p to unwrap rpc data\n", 499 dprintk("RPC: %5u using %s cred %p to unwrap rpc data\n",
494 task->tk_pid, cred->cr_ops->cr_name, cred); 500 task->tk_pid, cred->cr_ops->cr_name, cred);
@@ -496,7 +502,10 @@ rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp,
496 return cred->cr_ops->crunwrap_resp(task, decode, rqstp, 502 return cred->cr_ops->crunwrap_resp(task, decode, rqstp,
497 data, obj); 503 data, obj);
498 /* By default, we decode the arguments normally. */ 504 /* By default, we decode the arguments normally. */
499 return decode(rqstp, data, obj); 505 lock_kernel();
506 ret = decode(rqstp, data, obj);
507 unlock_kernel();
508 return ret;
500} 509}
501 510
502int 511int
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 17d460f85f0e..baf4096d52d4 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -999,7 +999,9 @@ gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
999 offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base; 999 offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base;
1000 *p++ = htonl(rqstp->rq_seqno); 1000 *p++ = htonl(rqstp->rq_seqno);
1001 1001
1002 lock_kernel();
1002 status = encode(rqstp, p, obj); 1003 status = encode(rqstp, p, obj);
1004 unlock_kernel();
1003 if (status) 1005 if (status)
1004 return status; 1006 return status;
1005 1007
@@ -1093,7 +1095,9 @@ gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
1093 offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base; 1095 offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base;
1094 *p++ = htonl(rqstp->rq_seqno); 1096 *p++ = htonl(rqstp->rq_seqno);
1095 1097
1098 lock_kernel();
1096 status = encode(rqstp, p, obj); 1099 status = encode(rqstp, p, obj);
1100 unlock_kernel();
1097 if (status) 1101 if (status)
1098 return status; 1102 return status;
1099 1103
@@ -1152,12 +1156,16 @@ gss_wrap_req(struct rpc_task *task,
1152 /* The spec seems a little ambiguous here, but I think that not 1156 /* The spec seems a little ambiguous here, but I think that not
1153 * wrapping context destruction requests makes the most sense. 1157 * wrapping context destruction requests makes the most sense.
1154 */ 1158 */
1159 lock_kernel();
1155 status = encode(rqstp, p, obj); 1160 status = encode(rqstp, p, obj);
1161 unlock_kernel();
1156 goto out; 1162 goto out;
1157 } 1163 }
1158 switch (gss_cred->gc_service) { 1164 switch (gss_cred->gc_service) {
1159 case RPC_GSS_SVC_NONE: 1165 case RPC_GSS_SVC_NONE:
1166 lock_kernel();
1160 status = encode(rqstp, p, obj); 1167 status = encode(rqstp, p, obj);
1168 unlock_kernel();
1161 break; 1169 break;
1162 case RPC_GSS_SVC_INTEGRITY: 1170 case RPC_GSS_SVC_INTEGRITY:
1163 status = gss_wrap_req_integ(cred, ctx, encode, 1171 status = gss_wrap_req_integ(cred, ctx, encode,
@@ -1273,7 +1281,9 @@ gss_unwrap_resp(struct rpc_task *task,
1273 cred->cr_auth->au_rslack = cred->cr_auth->au_verfsize + (p - savedp) 1281 cred->cr_auth->au_rslack = cred->cr_auth->au_verfsize + (p - savedp)
1274 + (savedlen - head->iov_len); 1282 + (savedlen - head->iov_len);
1275out_decode: 1283out_decode:
1284 lock_kernel();
1276 status = decode(rqstp, p, obj); 1285 status = decode(rqstp, p, obj);
1286 unlock_kernel();
1277out: 1287out:
1278 gss_put_ctx(ctx); 1288 gss_put_ctx(ctx);
1279 dprintk("RPC: %5u gss_unwrap_resp returning %d\n", task->tk_pid, 1289 dprintk("RPC: %5u gss_unwrap_resp returning %d\n", task->tk_pid,
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 5d3fe7b22488..52429b1ffcc1 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -904,10 +904,8 @@ call_encode(struct rpc_task *task)
904 if (encode == NULL) 904 if (encode == NULL)
905 return; 905 return;
906 906
907 lock_kernel();
908 task->tk_status = rpcauth_wrap_req(task, encode, req, p, 907 task->tk_status = rpcauth_wrap_req(task, encode, req, p,
909 task->tk_msg.rpc_argp); 908 task->tk_msg.rpc_argp);
910 unlock_kernel();
911 if (task->tk_status == -ENOMEM) { 909 if (task->tk_status == -ENOMEM) {
912 /* XXX: Is this sane? */ 910 /* XXX: Is this sane? */
913 rpc_delay(task, 3*HZ); 911 rpc_delay(task, 3*HZ);
@@ -1238,10 +1236,8 @@ call_decode(struct rpc_task *task)
1238 task->tk_action = rpc_exit_task; 1236 task->tk_action = rpc_exit_task;
1239 1237
1240 if (decode) { 1238 if (decode) {
1241 lock_kernel();
1242 task->tk_status = rpcauth_unwrap_resp(task, decode, req, p, 1239 task->tk_status = rpcauth_unwrap_resp(task, decode, req, p,
1243 task->tk_msg.rpc_resp); 1240 task->tk_msg.rpc_resp);
1244 unlock_kernel();
1245 } 1241 }
1246 dprintk("RPC: %5u call_decode result %d\n", task->tk_pid, 1242 dprintk("RPC: %5u call_decode result %d\n", task->tk_pid,
1247 task->tk_status); 1243 task->tk_status);