Skip to content

Commit 6e73e92

Browse files
scottmayhewJ. Bruce Fields
authored andcommitted
nfsd4: fix up replay_matches_cache()
When running an nfs stress test, I see quite a few cached replies that don't match up with the actual request. The first comment in replay_matches_cache() makes sense, but the code doesn't seem to match... fix it. This isn't exactly a bugfix, as the server isn't required to catch every case of a false retry. So, we may as well do this, but if this is fixing a problem then that suggests there's a client bug. Fixes: 53da6a5 ("nfsd4: catch some false session retries") Signed-off-by: Scott Mayhew <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
1 parent 832b2cb commit 6e73e92

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

fs/nfsd/nfs4state.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3548,12 +3548,17 @@ static bool replay_matches_cache(struct svc_rqst *rqstp,
35483548
(bool)seq->cachethis)
35493549
return false;
35503550
/*
3551-
* If there's an error than the reply can have fewer ops than
3552-
* the call. But if we cached a reply with *more* ops than the
3553-
* call you're sending us now, then this new call is clearly not
3554-
* really a replay of the old one:
3551+
* If there's an error then the reply can have fewer ops than
3552+
* the call.
35553553
*/
3556-
if (slot->sl_opcnt < argp->opcnt)
3554+
if (slot->sl_opcnt < argp->opcnt && !slot->sl_status)
3555+
return false;
3556+
/*
3557+
* But if we cached a reply with *more* ops than the call you're
3558+
* sending us now, then this new call is clearly not really a
3559+
* replay of the old one:
3560+
*/
3561+
if (slot->sl_opcnt > argp->opcnt)
35573562
return false;
35583563
/* This is the only check explicitly called by spec: */
35593564
if (!same_creds(&rqstp->rq_cred, &slot->sl_cred))

0 commit comments

Comments
 (0)