aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2007-07-11 18:39:02 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-19 15:21:39 -0400
commitbe879c4e249a8875d7129f3b0c1bb62584dafbd8 (patch)
tree6d6d774ac4dd24ff280e83e1d6a65be29a6dc6f8 /net/sunrpc/auth.c
parente3a535e1739a9da3cc316ccdfe5cd4bf84d745ac (diff)
SUNRPC: move bkl locking and xdr proc invocation into a common helper
Since every invocation of xdr encode or decode functions takes the BKL now, there's a lot of redundant lock_kernel/unlock_kernel pairs that we can pull out into a common function. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/auth.c')
-rw-r--r--net/sunrpc/auth.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 29a8ecc60928..1ea27559b1de 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -13,7 +13,6 @@
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>
17 16
18#ifdef RPC_DEBUG 17#ifdef RPC_DEBUG
19# define RPCDBG_FACILITY RPCDBG_AUTH 18# define RPCDBG_FACILITY RPCDBG_AUTH
@@ -476,17 +475,13 @@ rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp,
476 __be32 *data, void *obj) 475 __be32 *data, void *obj)
477{ 476{
478 struct rpc_cred *cred = task->tk_msg.rpc_cred; 477 struct rpc_cred *cred = task->tk_msg.rpc_cred;
479 int ret;
480 478
481 dprintk("RPC: %5u using %s cred %p to wrap rpc data\n", 479 dprintk("RPC: %5u using %s cred %p to wrap rpc data\n",
482 task->tk_pid, cred->cr_ops->cr_name, cred); 480 task->tk_pid, cred->cr_ops->cr_name, cred);
483 if (cred->cr_ops->crwrap_req) 481 if (cred->cr_ops->crwrap_req)
484 return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj); 482 return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj);
485 /* By default, we encode the arguments normally. */ 483 /* By default, we encode the arguments normally. */
486 lock_kernel(); 484 return rpc_call_xdrproc(encode, rqstp, data, obj);
487 ret = encode(rqstp, data, obj);
488 unlock_kernel();
489 return ret;
490} 485}
491 486
492int 487int
@@ -494,7 +489,6 @@ rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp,
494 __be32 *data, void *obj) 489 __be32 *data, void *obj)
495{ 490{
496 struct rpc_cred *cred = task->tk_msg.rpc_cred; 491 struct rpc_cred *cred = task->tk_msg.rpc_cred;
497 int ret;
498 492
499 dprintk("RPC: %5u using %s cred %p to unwrap rpc data\n", 493 dprintk("RPC: %5u using %s cred %p to unwrap rpc data\n",
500 task->tk_pid, cred->cr_ops->cr_name, cred); 494 task->tk_pid, cred->cr_ops->cr_name, cred);
@@ -502,10 +496,7 @@ rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp,
502 return cred->cr_ops->crunwrap_resp(task, decode, rqstp, 496 return cred->cr_ops->crunwrap_resp(task, decode, rqstp,
503 data, obj); 497 data, obj);
504 /* By default, we decode the arguments normally. */ 498 /* By default, we decode the arguments normally. */
505 lock_kernel(); 499 return rpc_call_xdrproc(decode, rqstp, data, obj);
506 ret = decode(rqstp, data, obj);
507 unlock_kernel();
508 return ret;
509} 500}
510 501
511int 502int