nfsd4.1: fix session memory use calculation
[safe/jmp/linux-2.6] / fs / nfsd / nfs4state.c
index 2153f9b..c171371 100644 (file)
@@ -477,13 +477,14 @@ static int set_forechannel_drc_size(struct nfsd4_channel_attrs *fchan)
 
 /*
  * fchan holds the client values on input, and the server values on output
+ * sv_max_mesg is the maximum payload plus one page for overhead.
  */
 static int init_forechannel_attrs(struct svc_rqst *rqstp,
                                  struct nfsd4_channel_attrs *session_fchan,
                                  struct nfsd4_channel_attrs *fchan)
 {
        int status = 0;
-       __u32   maxcount = svc_max_payload(rqstp);
+       __u32   maxcount = nfsd_serv->sv_max_mesg;
 
        /* headerpadsz set to zero in encode routine */
 
@@ -628,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);