Skip to content

Commit 728009f

Browse files
J. Bruce Fieldsgregkh
authored andcommitted
nfsd: give out fewer session slots as limit approaches
[ Upstream commit de766e5 ] Instead of granting client's full requests until we hit our DRC size limit and then failing CREATE_SESSIONs (and hence mounts) completely, start granting clients smaller slot tables as we approach the limit. The factor chosen here is pretty much arbitrary. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c499d67 commit 728009f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

fs/nfsd/nfs4state.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,11 @@ static u32 nfsd4_get_drc_mem(struct nfsd4_channel_attrs *ca)
13961396
spin_lock(&nfsd_drc_lock);
13971397
avail = min((unsigned long)NFSD_MAX_MEM_PER_SESSION,
13981398
nfsd_drc_max_mem - nfsd_drc_mem_used);
1399+
/*
1400+
* Never use more than a third of the remaining memory,
1401+
* unless it's the only way to give this client a slot:
1402+
*/
1403+
avail = clamp_t(int, avail, slotsize, avail/3);
13991404
num = min_t(int, num, avail / slotsize);
14001405
nfsd_drc_mem_used += num * slotsize;
14011406
spin_unlock(&nfsd_drc_lock);

0 commit comments

Comments
 (0)