diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2009-10-21 17:54:13 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-10-27 19:34:43 -0400 |
commit | dd829c45640ff14d7a039af40b3b3975f1b2e484 (patch) | |
tree | e19e0b89419521e5baeb095ca858493a2d47bcf7 /fs/nfsd/nfs4state.c | |
parent | dc7a08166f3a5f23e79e839a8a88849bd3397c32 (diff) |
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.c | 5 |
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 | |||
629 | free_session(struct kref *kref) | 629 | free_session(struct kref *kref) |
630 | { | 630 | { |
631 | struct nfsd4_session *ses; | 631 | struct nfsd4_session *ses; |
632 | int mem; | ||
632 | 633 | ||
633 | ses = container_of(kref, struct nfsd4_session, se_ref); | 634 | ses = container_of(kref, struct nfsd4_session, se_ref); |
634 | spin_lock(&nfsd_drc_lock); | 635 | spin_lock(&nfsd_drc_lock); |
635 | nfsd_drc_mem_used -= ses->se_fchannel.maxreqs * NFSD_SLOT_CACHE_SIZE; | 636 | mem = ses->se_fchannel.maxreqs |
637 | * (ses->se_fchannel.maxresp_cached - NFSD_MIN_HDR_SEQ_SZ); | ||
638 | nfsd_drc_mem_used -= mem; | ||
636 | spin_unlock(&nfsd_drc_lock); | 639 | spin_unlock(&nfsd_drc_lock); |
637 | free_session_slots(ses); | 640 | free_session_slots(ses); |
638 | kfree(ses); | 641 | kfree(ses); |