Merge tag 'rxrpc-rewrite-20161013' of git://git.kernel.org/pub/scm/linux/kernel/git...
[cascardo/linux.git] / net / sunrpc / auth.c
index 040ff62..2bff63a 100644 (file)
@@ -51,9 +51,7 @@ static int param_set_hashtbl_sz(const char *val, const struct kernel_param *kp)
        ret = kstrtoul(val, 0, &num);
        if (ret == -EINVAL)
                goto out_inval;
-       nbits = fls(num);
-       if (num > (1U << nbits))
-               nbits++;
+       nbits = fls(num - 1);
        if (nbits > MAX_HASHTABLE_BITS || nbits < 2)
                goto out_inval;
        *(unsigned int *)kp->arg = nbits;
@@ -359,8 +357,10 @@ rpcauth_key_timeout_notify(struct rpc_auth *auth, struct rpc_cred *cred)
 EXPORT_SYMBOL_GPL(rpcauth_key_timeout_notify);
 
 bool
-rpcauth_cred_key_to_expire(struct rpc_cred *cred)
+rpcauth_cred_key_to_expire(struct rpc_auth *auth, struct rpc_cred *cred)
 {
+       if (auth->au_flags & RPCAUTH_AUTH_NO_CRKEY_TIMEOUT)
+               return false;
        if (!cred->cr_ops->crkey_to_expire)
                return false;
        return cred->cr_ops->crkey_to_expire(cred);
@@ -551,7 +551,7 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
                        *entry, *new;
        unsigned int nr;
 
-       nr = hash_long(from_kuid(&init_user_ns, acred->uid), cache->hashbits);
+       nr = auth->au_ops->hash_cred(acred, cache->hashbits);
 
        rcu_read_lock();
        hlist_for_each_entry_rcu(entry, &cache->hashtable[nr], cr_hash) {