Skip to content

Commit a2c0412

Browse files
neilbrownchucklever
authored andcommitted
nfsd: Don't fail OP_SETCLIENTID when there are too many clients.
Failing OP_SETCLIENTID or OP_EXCHANGE_ID should only happen if there is memory allocation failure. Putting a hard limit on the number of clients is not really helpful as it will either happen too early and prevent clients that the server can easily handle, or too late and allow clients when the server is swamped. The calculated limit is still useful for expiring courtesy clients where there are "too many" clients, but it shouldn't prevent the creation of active clients. Testing of lots of clients against small-mem servers reports repeated NFS4ERR_DELAY responses which doesn't seem helpful. There may have been reports of similar problems in production use. Also remove an outdated comment - we do use a slab cache. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent ce89e74 commit a2c0412

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

fs/nfsd/nfs4state.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,21 +2231,16 @@ STALE_CLIENTID(clientid_t *clid, struct nfsd_net *nn)
22312231
return 1;
22322232
}
22332233

2234-
/*
2235-
* XXX Should we use a slab cache ?
2236-
* This type of memory management is somewhat inefficient, but we use it
2237-
* anyway since SETCLIENTID is not a common operation.
2238-
*/
22392234
static struct nfs4_client *alloc_client(struct xdr_netobj name,
22402235
struct nfsd_net *nn)
22412236
{
22422237
struct nfs4_client *clp;
22432238
int i;
22442239

2245-
if (atomic_read(&nn->nfs4_client_count) >= nn->nfs4_max_clients) {
2240+
if (atomic_read(&nn->nfs4_client_count) >= nn->nfs4_max_clients &&
2241+
atomic_read(&nn->nfsd_courtesy_clients) > 0)
22462242
mod_delayed_work(laundry_wq, &nn->laundromat_work, 0);
2247-
return NULL;
2248-
}
2243+
22492244
clp = kmem_cache_zalloc(client_slab, GFP_KERNEL);
22502245
if (clp == NULL)
22512246
return NULL;

0 commit comments

Comments
 (0)