diff options
Diffstat (limited to 'net/sunrpc/auth.c')
-rw-r--r-- | net/sunrpc/auth.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index e9eaaf7d43c1..cd6e4aa19dbf 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -326,10 +326,12 @@ rpcauth_prune_expired(struct list_head *free, int nr_to_scan) | |||
326 | * Run memory cache shrinker. | 326 | * Run memory cache shrinker. |
327 | */ | 327 | */ |
328 | static int | 328 | static int |
329 | rpcauth_cache_shrinker(struct shrinker *shrink, int nr_to_scan, gfp_t gfp_mask) | 329 | rpcauth_cache_shrinker(struct shrinker *shrink, struct shrink_control *sc) |
330 | { | 330 | { |
331 | LIST_HEAD(free); | 331 | LIST_HEAD(free); |
332 | int res; | 332 | int res; |
333 | int nr_to_scan = sc->nr_to_scan; | ||
334 | gfp_t gfp_mask = sc->gfp_mask; | ||
333 | 335 | ||
334 | if ((gfp_mask & GFP_KERNEL) != GFP_KERNEL) | 336 | if ((gfp_mask & GFP_KERNEL) != GFP_KERNEL) |
335 | return (nr_to_scan == 0) ? 0 : -1; | 337 | return (nr_to_scan == 0) ? 0 : -1; |
@@ -563,8 +565,17 @@ rpcauth_checkverf(struct rpc_task *task, __be32 *p) | |||
563 | return cred->cr_ops->crvalidate(task, p); | 565 | return cred->cr_ops->crvalidate(task, p); |
564 | } | 566 | } |
565 | 567 | ||
568 | static void rpcauth_wrap_req_encode(kxdreproc_t encode, struct rpc_rqst *rqstp, | ||
569 | __be32 *data, void *obj) | ||
570 | { | ||
571 | struct xdr_stream xdr; | ||
572 | |||
573 | xdr_init_encode(&xdr, &rqstp->rq_snd_buf, data); | ||
574 | encode(rqstp, &xdr, obj); | ||
575 | } | ||
576 | |||
566 | int | 577 | int |
567 | rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, | 578 | rpcauth_wrap_req(struct rpc_task *task, kxdreproc_t encode, void *rqstp, |
568 | __be32 *data, void *obj) | 579 | __be32 *data, void *obj) |
569 | { | 580 | { |
570 | struct rpc_cred *cred = task->tk_rqstp->rq_cred; | 581 | struct rpc_cred *cred = task->tk_rqstp->rq_cred; |
@@ -574,11 +585,22 @@ rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, | |||
574 | if (cred->cr_ops->crwrap_req) | 585 | if (cred->cr_ops->crwrap_req) |
575 | return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj); | 586 | return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj); |
576 | /* By default, we encode the arguments normally. */ | 587 | /* By default, we encode the arguments normally. */ |
577 | return encode(rqstp, data, obj); | 588 | rpcauth_wrap_req_encode(encode, rqstp, data, obj); |
589 | return 0; | ||
590 | } | ||
591 | |||
592 | static int | ||
593 | rpcauth_unwrap_req_decode(kxdrdproc_t decode, struct rpc_rqst *rqstp, | ||
594 | __be32 *data, void *obj) | ||
595 | { | ||
596 | struct xdr_stream xdr; | ||
597 | |||
598 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, data); | ||
599 | return decode(rqstp, &xdr, obj); | ||
578 | } | 600 | } |
579 | 601 | ||
580 | int | 602 | int |
581 | rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, | 603 | rpcauth_unwrap_resp(struct rpc_task *task, kxdrdproc_t decode, void *rqstp, |
582 | __be32 *data, void *obj) | 604 | __be32 *data, void *obj) |
583 | { | 605 | { |
584 | struct rpc_cred *cred = task->tk_rqstp->rq_cred; | 606 | struct rpc_cred *cred = task->tk_rqstp->rq_cred; |
@@ -589,13 +611,13 @@ rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, | |||
589 | return cred->cr_ops->crunwrap_resp(task, decode, rqstp, | 611 | return cred->cr_ops->crunwrap_resp(task, decode, rqstp, |
590 | data, obj); | 612 | data, obj); |
591 | /* By default, we decode the arguments normally. */ | 613 | /* By default, we decode the arguments normally. */ |
592 | return decode(rqstp, data, obj); | 614 | return rpcauth_unwrap_req_decode(decode, rqstp, data, obj); |
593 | } | 615 | } |
594 | 616 | ||
595 | int | 617 | int |
596 | rpcauth_refreshcred(struct rpc_task *task) | 618 | rpcauth_refreshcred(struct rpc_task *task) |
597 | { | 619 | { |
598 | struct rpc_cred *cred = task->tk_rqstp->rq_cred; | 620 | struct rpc_cred *cred; |
599 | int err; | 621 | int err; |
600 | 622 | ||
601 | cred = task->tk_rqstp->rq_cred; | 623 | cred = task->tk_rqstp->rq_cred; |
@@ -658,7 +680,7 @@ out1: | |||
658 | return err; | 680 | return err; |
659 | } | 681 | } |
660 | 682 | ||
661 | void __exit rpcauth_remove_module(void) | 683 | void rpcauth_remove_module(void) |
662 | { | 684 | { |
663 | rpc_destroy_authunix(); | 685 | rpc_destroy_authunix(); |
664 | rpc_destroy_generic_auth(); | 686 | rpc_destroy_generic_auth(); |