Skip to content

Commit de766e5

Browse files
author
J. Bruce Fields
committed
nfsd: give out fewer session slots as limit approaches
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>
1 parent 44d8660 commit de766e5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/nfsd/nfs4state.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,6 +1472,11 @@ static u32 nfsd4_get_drc_mem(struct nfsd4_channel_attrs *ca)
14721472
spin_lock(&nfsd_drc_lock);
14731473
avail = min((unsigned long)NFSD_MAX_MEM_PER_SESSION,
14741474
nfsd_drc_max_mem - nfsd_drc_mem_used);
1475+
/*
1476+
* Never use more than a third of the remaining memory,
1477+
* unless it's the only way to give this client a slot:
1478+
*/
1479+
avail = clamp_t(int, avail, slotsize, avail/3);
14751480
num = min_t(int, num, avail / slotsize);
14761481
nfsd_drc_mem_used += num * slotsize;
14771482
spin_unlock(&nfsd_drc_lock);

0 commit comments

Comments
 (0)