aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2009-10-21 17:54:13 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-10-27 19:34:43 -0400
commitdd829c45640ff14d7a039af40b3b3975f1b2e484 (patch)
treee19e0b89419521e5baeb095ca858493a2d47bcf7 /fs/nfsd/nfs4state.c
parentnfs: new subdir Documentation/filesystems/nfs (diff)
downloadlinux-dev-dd829c45640ff14d7a039af40b3b3975f1b2e484.tar.xz
linux-dev-dd829c45640ff14d7a039af40b3b3975f1b2e484.zip
nfsd4.1: fix session memory use calculation
Unbalanced calculations on creation and destruction of sessions could cause our estimate of cache memory used to become negative, sometimes resulting in spurious SERVERFAULT returns to client CREATE_SESSION requests. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index fcb9817881a1..c17137110412 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -629,10 +629,13 @@ void
free_session(struct kref *kref)
{
struct nfsd4_session *ses;
+ int mem;
ses = container_of(kref, struct nfsd4_session, se_ref);
spin_lock(&nfsd_drc_lock);
- nfsd_drc_mem_used -= ses->se_fchannel.maxreqs * NFSD_SLOT_CACHE_SIZE;
+ mem = ses->se_fchannel.maxreqs
+ * (ses->se_fchannel.maxresp_cached - NFSD_MIN_HDR_SEQ_SZ);
+ nfsd_drc_mem_used -= mem;
spin_unlock(&nfsd_drc_lock);
free_session_slots(ses);
kfree(ses);