2 * linux/net/sunrpc/auth.c
4 * Generic RPC client authentication API.
6 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
9 #include <linux/types.h>
10 #include <linux/sched.h>
11 #include <linux/cred.h>
12 #include <linux/module.h>
13 #include <linux/slab.h>
14 #include <linux/errno.h>
15 #include <linux/hash.h>
16 #include <linux/sunrpc/clnt.h>
17 #include <linux/sunrpc/gss_api.h>
18 #include <linux/spinlock.h>
20 #include <trace/events/sunrpc.h>
22 #define RPC_CREDCACHE_DEFAULT_HASHBITS (4)
23 struct rpc_cred_cache {
24 struct hlist_head *hashtable;
25 unsigned int hashbits;
29 static unsigned int auth_hashbits = RPC_CREDCACHE_DEFAULT_HASHBITS;
31 static const struct rpc_authops __rcu *auth_flavors[RPC_AUTH_MAXFLAVOR] = {
32 [RPC_AUTH_NULL] = (const struct rpc_authops __force __rcu *)&authnull_ops,
33 [RPC_AUTH_UNIX] = (const struct rpc_authops __force __rcu *)&authunix_ops,
34 NULL, /* others can be loadable modules */
37 static LIST_HEAD(cred_unused);
38 static unsigned long number_cred_unused;
40 static struct cred machine_cred = {
41 .usage = ATOMIC_INIT(1),
42 #ifdef CONFIG_DEBUG_CREDENTIALS
48 * Return the machine_cred pointer to be used whenever
49 * the a generic machine credential is needed.
51 const struct cred *rpc_machine_cred(void)
55 EXPORT_SYMBOL_GPL(rpc_machine_cred);
57 #define MAX_HASHTABLE_BITS (14)
58 static int param_set_hashtbl_sz(const char *val, const struct kernel_param *kp)
66 ret = kstrtoul(val, 0, &num);
70 if (nbits > MAX_HASHTABLE_BITS || nbits < 2)
72 *(unsigned int *)kp->arg = nbits;
78 static int param_get_hashtbl_sz(char *buffer, const struct kernel_param *kp)
82 nbits = *(unsigned int *)kp->arg;
83 return sprintf(buffer, "%u", 1U << nbits);
86 #define param_check_hashtbl_sz(name, p) __param_check(name, p, unsigned int);
88 static const struct kernel_param_ops param_ops_hashtbl_sz = {
89 .set = param_set_hashtbl_sz,
90 .get = param_get_hashtbl_sz,
93 module_param_named(auth_hashtable_size, auth_hashbits, hashtbl_sz, 0644);
94 MODULE_PARM_DESC(auth_hashtable_size, "RPC credential cache hashtable size");
96 static unsigned long auth_max_cred_cachesize = ULONG_MAX;
97 module_param(auth_max_cred_cachesize, ulong, 0644);
98 MODULE_PARM_DESC(auth_max_cred_cachesize, "RPC credential maximum total cache size");
101 pseudoflavor_to_flavor(u32 flavor) {
102 if (flavor > RPC_AUTH_MAXFLAVOR)
108 rpcauth_register(const struct rpc_authops *ops)
110 const struct rpc_authops *old;
111 rpc_authflavor_t flavor;
113 if ((flavor = ops->au_flavor) >= RPC_AUTH_MAXFLAVOR)
115 old = cmpxchg((const struct rpc_authops ** __force)&auth_flavors[flavor], NULL, ops);
116 if (old == NULL || old == ops)
120 EXPORT_SYMBOL_GPL(rpcauth_register);
123 rpcauth_unregister(const struct rpc_authops *ops)
125 const struct rpc_authops *old;
126 rpc_authflavor_t flavor;
128 if ((flavor = ops->au_flavor) >= RPC_AUTH_MAXFLAVOR)
131 old = cmpxchg((const struct rpc_authops ** __force)&auth_flavors[flavor], ops, NULL);
132 if (old == ops || old == NULL)
136 EXPORT_SYMBOL_GPL(rpcauth_unregister);
138 static const struct rpc_authops *
139 rpcauth_get_authops(rpc_authflavor_t flavor)
141 const struct rpc_authops *ops;
143 if (flavor >= RPC_AUTH_MAXFLAVOR)
147 ops = rcu_dereference(auth_flavors[flavor]);
150 request_module("rpc-auth-%u", flavor);
152 ops = rcu_dereference(auth_flavors[flavor]);
156 if (!try_module_get(ops->owner))
164 rpcauth_put_authops(const struct rpc_authops *ops)
166 module_put(ops->owner);
170 * rpcauth_get_pseudoflavor - check if security flavor is supported
171 * @flavor: a security flavor
172 * @info: a GSS mech OID, quality of protection, and service value
174 * Verifies that an appropriate kernel module is available or already loaded.
175 * Returns an equivalent pseudoflavor, or RPC_AUTH_MAXFLAVOR if "flavor" is
176 * not supported locally.
179 rpcauth_get_pseudoflavor(rpc_authflavor_t flavor, struct rpcsec_gss_info *info)
181 const struct rpc_authops *ops = rpcauth_get_authops(flavor);
182 rpc_authflavor_t pseudoflavor;
185 return RPC_AUTH_MAXFLAVOR;
186 pseudoflavor = flavor;
187 if (ops->info2flavor != NULL)
188 pseudoflavor = ops->info2flavor(info);
190 rpcauth_put_authops(ops);
193 EXPORT_SYMBOL_GPL(rpcauth_get_pseudoflavor);
196 * rpcauth_get_gssinfo - find GSS tuple matching a GSS pseudoflavor
197 * @pseudoflavor: GSS pseudoflavor to match
198 * @info: rpcsec_gss_info structure to fill in
200 * Returns zero and fills in "info" if pseudoflavor matches a
201 * supported mechanism.
204 rpcauth_get_gssinfo(rpc_authflavor_t pseudoflavor, struct rpcsec_gss_info *info)
206 rpc_authflavor_t flavor = pseudoflavor_to_flavor(pseudoflavor);
207 const struct rpc_authops *ops;
210 ops = rpcauth_get_authops(flavor);
215 if (ops->flavor2info != NULL)
216 result = ops->flavor2info(pseudoflavor, info);
218 rpcauth_put_authops(ops);
221 EXPORT_SYMBOL_GPL(rpcauth_get_gssinfo);
224 * rpcauth_list_flavors - discover registered flavors and pseudoflavors
225 * @array: array to fill in
226 * @size: size of "array"
228 * Returns the number of array items filled in, or a negative errno.
230 * The returned array is not sorted by any policy. Callers should not
231 * rely on the order of the items in the returned array.
234 rpcauth_list_flavors(rpc_authflavor_t *array, int size)
236 const struct rpc_authops *ops;
237 rpc_authflavor_t flavor, pseudos[4];
238 int i, len, result = 0;
241 for (flavor = 0; flavor < RPC_AUTH_MAXFLAVOR; flavor++) {
242 ops = rcu_dereference(auth_flavors[flavor]);
243 if (result >= size) {
250 if (ops->list_pseudoflavors == NULL) {
251 array[result++] = ops->au_flavor;
254 len = ops->list_pseudoflavors(pseudos, ARRAY_SIZE(pseudos));
259 for (i = 0; i < len; i++) {
260 if (result >= size) {
264 array[result++] = pseudos[i];
270 EXPORT_SYMBOL_GPL(rpcauth_list_flavors);
273 rpcauth_create(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt)
275 struct rpc_auth *auth = ERR_PTR(-EINVAL);
276 const struct rpc_authops *ops;
277 u32 flavor = pseudoflavor_to_flavor(args->pseudoflavor);
279 ops = rpcauth_get_authops(flavor);
283 auth = ops->create(args, clnt);
285 rpcauth_put_authops(ops);
289 rpcauth_release(clnt->cl_auth);
290 clnt->cl_auth = auth;
295 EXPORT_SYMBOL_GPL(rpcauth_create);
298 rpcauth_release(struct rpc_auth *auth)
300 if (!refcount_dec_and_test(&auth->au_count))
302 auth->au_ops->destroy(auth);
305 static DEFINE_SPINLOCK(rpc_credcache_lock);
308 * On success, the caller is responsible for freeing the reference
309 * held by the hashtable
312 rpcauth_unhash_cred_locked(struct rpc_cred *cred)
314 if (!test_and_clear_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags))
316 hlist_del_rcu(&cred->cr_hash);
321 rpcauth_unhash_cred(struct rpc_cred *cred)
323 spinlock_t *cache_lock;
326 if (!test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags))
328 cache_lock = &cred->cr_auth->au_credcache->lock;
329 spin_lock(cache_lock);
330 ret = rpcauth_unhash_cred_locked(cred);
331 spin_unlock(cache_lock);
336 * Initialize RPC credential cache
339 rpcauth_init_credcache(struct rpc_auth *auth)
341 struct rpc_cred_cache *new;
342 unsigned int hashsize;
344 new = kmalloc(sizeof(*new), GFP_KERNEL);
347 new->hashbits = auth_hashbits;
348 hashsize = 1U << new->hashbits;
349 new->hashtable = kcalloc(hashsize, sizeof(new->hashtable[0]), GFP_KERNEL);
352 spin_lock_init(&new->lock);
353 auth->au_credcache = new;
360 EXPORT_SYMBOL_GPL(rpcauth_init_credcache);
363 rpcauth_stringify_acceptor(struct rpc_cred *cred)
365 if (!cred->cr_ops->crstringify_acceptor)
367 return cred->cr_ops->crstringify_acceptor(cred);
369 EXPORT_SYMBOL_GPL(rpcauth_stringify_acceptor);
372 * Destroy a list of credentials
375 void rpcauth_destroy_credlist(struct list_head *head)
377 struct rpc_cred *cred;
379 while (!list_empty(head)) {
380 cred = list_entry(head->next, struct rpc_cred, cr_lru);
381 list_del_init(&cred->cr_lru);
387 rpcauth_lru_add_locked(struct rpc_cred *cred)
389 if (!list_empty(&cred->cr_lru))
391 number_cred_unused++;
392 list_add_tail(&cred->cr_lru, &cred_unused);
396 rpcauth_lru_add(struct rpc_cred *cred)
398 if (!list_empty(&cred->cr_lru))
400 spin_lock(&rpc_credcache_lock);
401 rpcauth_lru_add_locked(cred);
402 spin_unlock(&rpc_credcache_lock);
406 rpcauth_lru_remove_locked(struct rpc_cred *cred)
408 if (list_empty(&cred->cr_lru))
410 number_cred_unused--;
411 list_del_init(&cred->cr_lru);
415 rpcauth_lru_remove(struct rpc_cred *cred)
417 if (list_empty(&cred->cr_lru))
419 spin_lock(&rpc_credcache_lock);
420 rpcauth_lru_remove_locked(cred);
421 spin_unlock(&rpc_credcache_lock);
425 * Clear the RPC credential cache, and delete those credentials
426 * that are not referenced.
429 rpcauth_clear_credcache(struct rpc_cred_cache *cache)
432 struct hlist_head *head;
433 struct rpc_cred *cred;
434 unsigned int hashsize = 1U << cache->hashbits;
437 spin_lock(&rpc_credcache_lock);
438 spin_lock(&cache->lock);
439 for (i = 0; i < hashsize; i++) {
440 head = &cache->hashtable[i];
441 while (!hlist_empty(head)) {
442 cred = hlist_entry(head->first, struct rpc_cred, cr_hash);
443 rpcauth_unhash_cred_locked(cred);
444 /* Note: We now hold a reference to cred */
445 rpcauth_lru_remove_locked(cred);
446 list_add_tail(&cred->cr_lru, &free);
449 spin_unlock(&cache->lock);
450 spin_unlock(&rpc_credcache_lock);
451 rpcauth_destroy_credlist(&free);
455 * Destroy the RPC credential cache
458 rpcauth_destroy_credcache(struct rpc_auth *auth)
460 struct rpc_cred_cache *cache = auth->au_credcache;
463 auth->au_credcache = NULL;
464 rpcauth_clear_credcache(cache);
465 kfree(cache->hashtable);
469 EXPORT_SYMBOL_GPL(rpcauth_destroy_credcache);
472 #define RPC_AUTH_EXPIRY_MORATORIUM (60 * HZ)
475 * Remove stale credentials. Avoid sleeping inside the loop.
478 rpcauth_prune_expired(struct list_head *free, int nr_to_scan)
480 struct rpc_cred *cred, *next;
481 unsigned long expired = jiffies - RPC_AUTH_EXPIRY_MORATORIUM;
484 list_for_each_entry_safe(cred, next, &cred_unused, cr_lru) {
486 if (nr_to_scan-- == 0)
488 if (refcount_read(&cred->cr_count) > 1) {
489 rpcauth_lru_remove_locked(cred);
493 * Enforce a 60 second garbage collection moratorium
494 * Note that the cred_unused list must be time-ordered.
496 if (!time_in_range(cred->cr_expire, expired, jiffies))
498 if (!rpcauth_unhash_cred(cred))
501 rpcauth_lru_remove_locked(cred);
503 list_add_tail(&cred->cr_lru, free);
505 return freed ? freed : SHRINK_STOP;
509 rpcauth_cache_do_shrink(int nr_to_scan)
514 spin_lock(&rpc_credcache_lock);
515 freed = rpcauth_prune_expired(&free, nr_to_scan);
516 spin_unlock(&rpc_credcache_lock);
517 rpcauth_destroy_credlist(&free);
523 * Run memory cache shrinker.
526 rpcauth_cache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
529 if ((sc->gfp_mask & GFP_KERNEL) != GFP_KERNEL)
532 /* nothing left, don't come back */
533 if (list_empty(&cred_unused))
536 return rpcauth_cache_do_shrink(sc->nr_to_scan);
540 rpcauth_cache_shrink_count(struct shrinker *shrink, struct shrink_control *sc)
543 return number_cred_unused * sysctl_vfs_cache_pressure / 100;
547 rpcauth_cache_enforce_limit(void)
550 unsigned int nr_to_scan;
552 if (number_cred_unused <= auth_max_cred_cachesize)
554 diff = number_cred_unused - auth_max_cred_cachesize;
556 if (diff < nr_to_scan)
558 rpcauth_cache_do_shrink(nr_to_scan);
562 * Look up a process' credentials in the authentication cache
565 rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
566 int flags, gfp_t gfp)
569 struct rpc_cred_cache *cache = auth->au_credcache;
570 struct rpc_cred *cred = NULL,
574 nr = auth->au_ops->hash_cred(acred, cache->hashbits);
577 hlist_for_each_entry_rcu(entry, &cache->hashtable[nr], cr_hash) {
578 if (!entry->cr_ops->crmatch(acred, entry, flags))
580 cred = get_rpccred(entry);
589 new = auth->au_ops->crcreate(auth, acred, flags, gfp);
595 spin_lock(&cache->lock);
596 hlist_for_each_entry(entry, &cache->hashtable[nr], cr_hash) {
597 if (!entry->cr_ops->crmatch(acred, entry, flags))
599 cred = get_rpccred(entry);
605 set_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags);
606 refcount_inc(&cred->cr_count);
607 hlist_add_head_rcu(&cred->cr_hash, &cache->hashtable[nr]);
609 list_add_tail(&new->cr_lru, &free);
610 spin_unlock(&cache->lock);
611 rpcauth_cache_enforce_limit();
613 if (test_bit(RPCAUTH_CRED_NEW, &cred->cr_flags) &&
614 cred->cr_ops->cr_init != NULL &&
615 !(flags & RPCAUTH_LOOKUP_NEW)) {
616 int res = cred->cr_ops->cr_init(auth, cred);
622 rpcauth_destroy_credlist(&free);
626 EXPORT_SYMBOL_GPL(rpcauth_lookup_credcache);
629 rpcauth_lookupcred(struct rpc_auth *auth, int flags)
631 struct auth_cred acred;
632 struct rpc_cred *ret;
633 const struct cred *cred = current_cred();
635 memset(&acred, 0, sizeof(acred));
637 ret = auth->au_ops->lookup_cred(auth, &acred, flags);
640 EXPORT_SYMBOL_GPL(rpcauth_lookupcred);
643 rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred,
644 struct rpc_auth *auth, const struct rpc_credops *ops)
646 INIT_HLIST_NODE(&cred->cr_hash);
647 INIT_LIST_HEAD(&cred->cr_lru);
648 refcount_set(&cred->cr_count, 1);
649 cred->cr_auth = auth;
652 cred->cr_expire = jiffies;
653 cred->cr_cred = get_cred(acred->cred);
655 EXPORT_SYMBOL_GPL(rpcauth_init_cred);
657 static struct rpc_cred *
658 rpcauth_bind_root_cred(struct rpc_task *task, int lookupflags)
660 struct rpc_auth *auth = task->tk_client->cl_auth;
661 struct auth_cred acred = {
662 .cred = get_task_cred(&init_task),
664 struct rpc_cred *ret;
666 ret = auth->au_ops->lookup_cred(auth, &acred, lookupflags);
667 put_cred(acred.cred);
671 static struct rpc_cred *
672 rpcauth_bind_machine_cred(struct rpc_task *task, int lookupflags)
674 struct rpc_auth *auth = task->tk_client->cl_auth;
675 struct auth_cred acred = {
676 .principal = task->tk_client->cl_principal,
677 .cred = init_task.cred,
680 if (!acred.principal)
682 return auth->au_ops->lookup_cred(auth, &acred, lookupflags);
685 static struct rpc_cred *
686 rpcauth_bind_new_cred(struct rpc_task *task, int lookupflags)
688 struct rpc_auth *auth = task->tk_client->cl_auth;
690 return rpcauth_lookupcred(auth, lookupflags);
694 rpcauth_bindcred(struct rpc_task *task, const struct cred *cred, int flags)
696 struct rpc_rqst *req = task->tk_rqstp;
697 struct rpc_cred *new = NULL;
699 struct rpc_auth *auth = task->tk_client->cl_auth;
700 struct auth_cred acred = {
704 if (flags & RPC_TASK_ASYNC)
705 lookupflags |= RPCAUTH_LOOKUP_NEW;
706 if (task->tk_op_cred)
707 /* Task must use exactly this rpc_cred */
708 new = get_rpccred(task->tk_op_cred);
709 else if (cred != NULL && cred != &machine_cred)
710 new = auth->au_ops->lookup_cred(auth, &acred, lookupflags);
711 else if (cred == &machine_cred)
712 new = rpcauth_bind_machine_cred(task, lookupflags);
714 /* If machine cred couldn't be bound, try a root cred */
717 else if (cred == &machine_cred || (flags & RPC_TASK_ROOTCREDS))
718 new = rpcauth_bind_root_cred(task, lookupflags);
719 else if (flags & RPC_TASK_NULLCREDS)
720 new = authnull_ops.lookup_cred(NULL, NULL, 0);
722 new = rpcauth_bind_new_cred(task, lookupflags);
725 put_rpccred(req->rq_cred);
731 put_rpccred(struct rpc_cred *cred)
736 if (refcount_dec_and_test(&cred->cr_count))
738 if (refcount_read(&cred->cr_count) != 1 ||
739 !test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags))
741 if (test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) != 0) {
742 cred->cr_expire = jiffies;
743 rpcauth_lru_add(cred);
745 if (unlikely(!test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags)))
746 rpcauth_lru_remove(cred);
747 } else if (rpcauth_unhash_cred(cred)) {
748 rpcauth_lru_remove(cred);
749 if (refcount_dec_and_test(&cred->cr_count))
757 cred->cr_ops->crdestroy(cred);
759 EXPORT_SYMBOL_GPL(put_rpccred);
762 * rpcauth_marshcred - Append RPC credential to end of @xdr
763 * @task: controlling RPC task
764 * @xdr: xdr_stream containing initial portion of RPC Call header
766 * On success, an appropriate verifier is added to @xdr, @xdr is
767 * updated to point past the verifier, and zero is returned.
768 * Otherwise, @xdr is in an undefined state and a negative errno
771 int rpcauth_marshcred(struct rpc_task *task, struct xdr_stream *xdr)
773 const struct rpc_credops *ops = task->tk_rqstp->rq_cred->cr_ops;
775 return ops->crmarshal(task, xdr);
779 * rpcauth_wrap_req_encode - XDR encode the RPC procedure
780 * @task: controlling RPC task
781 * @xdr: stream where on-the-wire bytes are to be marshalled
783 * On success, @xdr contains the encoded and wrapped message.
784 * Otherwise, @xdr is in an undefined state.
786 int rpcauth_wrap_req_encode(struct rpc_task *task, struct xdr_stream *xdr)
788 kxdreproc_t encode = task->tk_msg.rpc_proc->p_encode;
790 encode(task->tk_rqstp, xdr, task->tk_msg.rpc_argp);
793 EXPORT_SYMBOL_GPL(rpcauth_wrap_req_encode);
796 * rpcauth_wrap_req - XDR encode and wrap the RPC procedure
797 * @task: controlling RPC task
798 * @xdr: stream where on-the-wire bytes are to be marshalled
800 * On success, @xdr contains the encoded and wrapped message,
801 * and zero is returned. Otherwise, @xdr is in an undefined
802 * state and a negative errno is returned.
804 int rpcauth_wrap_req(struct rpc_task *task, struct xdr_stream *xdr)
806 const struct rpc_credops *ops = task->tk_rqstp->rq_cred->cr_ops;
808 return ops->crwrap_req(task, xdr);
812 * rpcauth_checkverf - Validate verifier in RPC Reply header
813 * @task: controlling RPC task
814 * @xdr: xdr_stream containing RPC Reply header
816 * On success, @xdr is updated to point past the verifier and
817 * zero is returned. Otherwise, @xdr is in an undefined state
818 * and a negative errno is returned.
821 rpcauth_checkverf(struct rpc_task *task, struct xdr_stream *xdr)
823 const struct rpc_credops *ops = task->tk_rqstp->rq_cred->cr_ops;
825 return ops->crvalidate(task, xdr);
829 * rpcauth_unwrap_resp_decode - Invoke XDR decode function
830 * @task: controlling RPC task
831 * @xdr: stream where the Reply message resides
833 * Returns zero on success; otherwise a negative errno is returned.
836 rpcauth_unwrap_resp_decode(struct rpc_task *task, struct xdr_stream *xdr)
838 kxdrdproc_t decode = task->tk_msg.rpc_proc->p_decode;
840 return decode(task->tk_rqstp, xdr, task->tk_msg.rpc_resp);
842 EXPORT_SYMBOL_GPL(rpcauth_unwrap_resp_decode);
845 * rpcauth_unwrap_resp - Invoke unwrap and decode function for the cred
846 * @task: controlling RPC task
847 * @xdr: stream where the Reply message resides
849 * Returns zero on success; otherwise a negative errno is returned.
852 rpcauth_unwrap_resp(struct rpc_task *task, struct xdr_stream *xdr)
854 const struct rpc_credops *ops = task->tk_rqstp->rq_cred->cr_ops;
856 return ops->crunwrap_resp(task, xdr);
860 rpcauth_xmit_need_reencode(struct rpc_task *task)
862 struct rpc_cred *cred = task->tk_rqstp->rq_cred;
864 if (!cred || !cred->cr_ops->crneed_reencode)
866 return cred->cr_ops->crneed_reencode(task);
870 rpcauth_refreshcred(struct rpc_task *task)
872 struct rpc_cred *cred;
875 cred = task->tk_rqstp->rq_cred;
877 err = rpcauth_bindcred(task, task->tk_msg.rpc_cred, task->tk_flags);
880 cred = task->tk_rqstp->rq_cred;
883 err = cred->cr_ops->crrefresh(task);
886 task->tk_status = err;
891 rpcauth_invalcred(struct rpc_task *task)
893 struct rpc_cred *cred = task->tk_rqstp->rq_cred;
896 clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
900 rpcauth_uptodatecred(struct rpc_task *task)
902 struct rpc_cred *cred = task->tk_rqstp->rq_cred;
904 return cred == NULL ||
905 test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) != 0;
908 static struct shrinker rpc_cred_shrinker = {
909 .count_objects = rpcauth_cache_shrink_count,
910 .scan_objects = rpcauth_cache_shrink_scan,
911 .seeks = DEFAULT_SEEKS,
914 int __init rpcauth_init_module(void)
918 err = rpc_init_authunix();
921 err = register_shrinker(&rpc_cred_shrinker);
926 rpc_destroy_authunix();
931 void rpcauth_remove_module(void)
933 rpc_destroy_authunix();
934 unregister_shrinker(&rpc_cred_shrinker);