Skip to content

Commit

Permalink
nfsd4.1: fix session memory use calculation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
J. Bruce Fields committed Oct 27, 2009
1 parent dc7a081 commit dd829c4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit dd829c4

Please sign in to comment.