Add kern.rpc.gss.client_max, to make it possible to bump it easily.

This can drastically lower the load on gssd(8) on large NFS servers.

Submitted by:	Per Andersson <pa at chalmers dot se>
Reviewed by:	rmacklem@
MFC after:	2 weeks
Sponsored by:	Chalmers University of Technology
Differential Revision:	https://reviews.freebsd.org/D18393
This commit is contained in:
Edward Tomasz Napierala 2018-12-15 11:32:11 +00:00
parent 4849c3a570
commit b329fb2885

View File

@ -171,9 +171,22 @@ struct svc_rpc_gss_cookedcred {
#define CLIENT_HASH_SIZE 256
#define CLIENT_MAX 128
u_int svc_rpc_gss_client_max = CLIENT_MAX;
SYSCTL_NODE(_kern, OID_AUTO, rpc, CTLFLAG_RW, 0, "RPC");
SYSCTL_NODE(_kern_rpc, OID_AUTO, gss, CTLFLAG_RW, 0, "GSS");
SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_max, CTLFLAG_RW,
&svc_rpc_gss_client_max, 0,
"Max number of rpc-gss clients");
static u_int svc_rpc_gss_client_count;
SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_count, CTLFLAG_RD,
&svc_rpc_gss_client_count, 0,
"Number of rpc-gss clients");
struct svc_rpc_gss_client_list svc_rpc_gss_client_hash[CLIENT_HASH_SIZE];
struct svc_rpc_gss_client_list svc_rpc_gss_clients;
static size_t svc_rpc_gss_client_count;
static uint32_t svc_rpc_gss_next_clientid = 1;
static void
@ -669,7 +682,7 @@ svc_rpc_gss_timeout_clients(void)
*/
sx_xlock(&svc_rpc_gss_lock);
client = TAILQ_LAST(&svc_rpc_gss_clients, svc_rpc_gss_client_list);
while (svc_rpc_gss_client_count > CLIENT_MAX && client != NULL) {
while (svc_rpc_gss_client_count > svc_rpc_gss_client_max && client != NULL) {
svc_rpc_gss_forget_client_locked(client);
sx_xunlock(&svc_rpc_gss_lock);
svc_rpc_gss_release_client(client);