]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
nfsd: fix uninitialised slot info when a request is retried
authorNeilBrown <neilb@suse.de>
Mon, 27 Jan 2025 23:05:03 +0000 (10:05 +1100)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 10 Feb 2025 18:30:55 +0000 (13:30 -0500)
A recent patch moved the assignment of seq->maxslots from before the
test for a resent request (which ends with a goto) to after, resulting
in it not being run in that case.  This results in the server returning
bogus "high slot id" and "target high slot id" values.

The assignments to ->maxslots and ->target_maxslots need to be *after*
the out: label so that the correct values are returned in replies to
requests that are served from cache.

Fixes: 60aa6564317d ("nfsd: allocate new session-based DRC slots on demand.")
Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4state.c

index b7a0cfd05401d406412119b3b8acf5d4fc020262..153eeea2c7c999d003cd1f36cecb0dd4f6e049b8 100644 (file)
@@ -4459,10 +4459,11 @@ nfsd4_sequence(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                        }
                } while (slot && --cnt > 0);
        }
+
+out:
        seq->maxslots = max(session->se_target_maxslots, seq->maxslots);
        seq->target_maxslots = session->se_target_maxslots;
 
-out:
        switch (clp->cl_cb_state) {
        case NFSD4_CB_DOWN:
                seq->status_flags = SEQ4_STATUS_CB_PATH_DOWN;