diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2007-07-11 18:39:02 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-19 15:21:39 -0400 |
commit | be879c4e249a8875d7129f3b0c1bb62584dafbd8 (patch) | |
tree | 6d6d774ac4dd24ff280e83e1d6a65be29a6dc6f8 /net/sunrpc/auth_gss/auth_gss.c | |
parent | e3a535e1739a9da3cc316ccdfe5cd4bf84d745ac (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_gss/auth_gss.c')
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index abfda33bac64..4bbc59cc237c 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <linux/types.h> | 43 | #include <linux/types.h> |
44 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
45 | #include <linux/sched.h> | 45 | #include <linux/sched.h> |
46 | #include <linux/smp_lock.h> | ||
47 | #include <linux/pagemap.h> | 46 | #include <linux/pagemap.h> |
48 | #include <linux/sunrpc/clnt.h> | 47 | #include <linux/sunrpc/clnt.h> |
49 | #include <linux/sunrpc/auth.h> | 48 | #include <linux/sunrpc/auth.h> |
@@ -1000,9 +999,7 @@ gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | |||
1000 | offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base; | 999 | offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base; |
1001 | *p++ = htonl(rqstp->rq_seqno); | 1000 | *p++ = htonl(rqstp->rq_seqno); |
1002 | 1001 | ||
1003 | lock_kernel(); | 1002 | status = rpc_call_xdrproc(encode, rqstp, p, obj); |
1004 | status = encode(rqstp, p, obj); | ||
1005 | unlock_kernel(); | ||
1006 | if (status) | 1003 | if (status) |
1007 | return status; | 1004 | return status; |
1008 | 1005 | ||
@@ -1096,9 +1093,7 @@ gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | |||
1096 | offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base; | 1093 | offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base; |
1097 | *p++ = htonl(rqstp->rq_seqno); | 1094 | *p++ = htonl(rqstp->rq_seqno); |
1098 | 1095 | ||
1099 | lock_kernel(); | 1096 | status = rpc_call_xdrproc(encode, rqstp, p, obj); |
1100 | status = encode(rqstp, p, obj); | ||
1101 | unlock_kernel(); | ||
1102 | if (status) | 1097 | if (status) |
1103 | return status; | 1098 | return status; |
1104 | 1099 | ||
@@ -1157,16 +1152,12 @@ gss_wrap_req(struct rpc_task *task, | |||
1157 | /* The spec seems a little ambiguous here, but I think that not | 1152 | /* The spec seems a little ambiguous here, but I think that not |
1158 | * wrapping context destruction requests makes the most sense. | 1153 | * wrapping context destruction requests makes the most sense. |
1159 | */ | 1154 | */ |
1160 | lock_kernel(); | 1155 | status = rpc_call_xdrproc(encode, rqstp, p, obj); |
1161 | status = encode(rqstp, p, obj); | ||
1162 | unlock_kernel(); | ||
1163 | goto out; | 1156 | goto out; |
1164 | } | 1157 | } |
1165 | switch (gss_cred->gc_service) { | 1158 | switch (gss_cred->gc_service) { |
1166 | case RPC_GSS_SVC_NONE: | 1159 | case RPC_GSS_SVC_NONE: |
1167 | lock_kernel(); | 1160 | status = rpc_call_xdrproc(encode, rqstp, p, obj); |
1168 | status = encode(rqstp, p, obj); | ||
1169 | unlock_kernel(); | ||
1170 | break; | 1161 | break; |
1171 | case RPC_GSS_SVC_INTEGRITY: | 1162 | case RPC_GSS_SVC_INTEGRITY: |
1172 | status = gss_wrap_req_integ(cred, ctx, encode, | 1163 | status = gss_wrap_req_integ(cred, ctx, encode, |
@@ -1282,9 +1273,7 @@ gss_unwrap_resp(struct rpc_task *task, | |||
1282 | cred->cr_auth->au_rslack = cred->cr_auth->au_verfsize + (p - savedp) | 1273 | cred->cr_auth->au_rslack = cred->cr_auth->au_verfsize + (p - savedp) |
1283 | + (savedlen - head->iov_len); | 1274 | + (savedlen - head->iov_len); |
1284 | out_decode: | 1275 | out_decode: |
1285 | lock_kernel(); | 1276 | status = rpc_call_xdrproc(decode, rqstp, p, obj); |
1286 | status = decode(rqstp, p, obj); | ||
1287 | unlock_kernel(); | ||
1288 | out: | 1277 | out: |
1289 | gss_put_ctx(ctx); | 1278 | gss_put_ctx(ctx); |
1290 | dprintk("RPC: %5u gss_unwrap_resp returning %d\n", task->tk_pid, | 1279 | dprintk("RPC: %5u gss_unwrap_resp returning %d\n", task->tk_pid, |