Skip to content

Commit eb073fb

Browse files
J. Bruce Fieldsjfvogel
authored andcommitted
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 <[email protected]> (cherry picked from commit de766e5) orabug: 28427489 Signed-off-by: Manjunath Patil <[email protected]> Reviewed-by: Calum Mackay <[email protected]>
1 parent ef8d36c commit eb073fb

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
@@ -1505,6 +1505,11 @@ static u32 nfsd4_get_drc_mem(struct nfsd4_channel_attrs *ca)
15051505
spin_lock(&nfsd_drc_lock);
15061506
avail = min((unsigned long)NFSD_MAX_MEM_PER_SESSION,
15071507
nfsd_drc_max_mem - nfsd_drc_mem_used);
1508+
/*
1509+
* Never use more than a third of the remaining memory,
1510+
* unless it's the only way to give this client a slot:
1511+
*/
1512+
avail = clamp_t(int, avail, slotsize, avail/3);
15081513
num = min_t(int, num, avail / slotsize);
15091514
nfsd_drc_mem_used += num * slotsize;
15101515
spin_unlock(&nfsd_drc_lock);

0 commit comments

Comments
 (0)