aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/nfs4state.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index fb3c9844c82a..6a45fb00c5fc 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1544,16 +1544,16 @@ static u32 nfsd4_get_drc_mem(struct nfsd4_channel_attrs *ca)
1544{ 1544{
1545 u32 slotsize = slot_bytes(ca); 1545 u32 slotsize = slot_bytes(ca);
1546 u32 num = ca->maxreqs; 1546 u32 num = ca->maxreqs;
1547 int avail; 1547 unsigned long avail, total_avail;
1548 1548
1549 spin_lock(&nfsd_drc_lock); 1549 spin_lock(&nfsd_drc_lock);
1550 avail = min((unsigned long)NFSD_MAX_MEM_PER_SESSION, 1550 total_avail = nfsd_drc_max_mem - nfsd_drc_mem_used;
1551 nfsd_drc_max_mem - nfsd_drc_mem_used); 1551 avail = min((unsigned long)NFSD_MAX_MEM_PER_SESSION, total_avail);
1552 /* 1552 /*
1553 * Never use more than a third of the remaining memory, 1553 * Never use more than a third of the remaining memory,
1554 * unless it's the only way to give this client a slot: 1554 * unless it's the only way to give this client a slot:
1555 */ 1555 */
1556 avail = clamp_t(int, avail, slotsize, avail/3); 1556 avail = clamp_t(int, avail, slotsize, total_avail/3);
1557 num = min_t(int, num, avail / slotsize); 1557 num = min_t(int, num, avail / slotsize);
1558 nfsd_drc_mem_used += num * slotsize; 1558 nfsd_drc_mem_used += num * slotsize;
1559 spin_unlock(&nfsd_drc_lock); 1559 spin_unlock(&nfsd_drc_lock);