Commit 6e73e92b authored by Scott Mayhew's avatar Scott Mayhew Committed by J. Bruce Fields

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: 53da6a53 ("nfsd4: catch some false session retries")
Signed-off-by: default avatarScott Mayhew <smayhew@redhat.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 832b2cb9
...@@ -3548,12 +3548,17 @@ static bool replay_matches_cache(struct svc_rqst *rqstp, ...@@ -3548,12 +3548,17 @@ static bool replay_matches_cache(struct svc_rqst *rqstp,
(bool)seq->cachethis) (bool)seq->cachethis)
return false; return false;
/* /*
* If there's an error than the reply can have fewer ops than * If there's an error then the reply can have fewer ops than
* the call. But if we cached a reply with *more* ops than the * the call.
* call you're sending us now, then this new call is clearly not
* really a replay of the old one:
*/ */
if (slot->sl_opcnt < argp->opcnt) if (slot->sl_opcnt < argp->opcnt && !slot->sl_status)
return false;
/*
* But if we cached a reply with *more* ops than the call you're
* sending us now, then this new call is clearly not really a
* replay of the old one:
*/
if (slot->sl_opcnt > argp->opcnt)
return false; return false;
/* This is the only check explicitly called by spec: */ /* This is the only check explicitly called by spec: */
if (!same_creds(&rqstp->rq_cred, &slot->sl_cred)) if (!same_creds(&rqstp->rq_cred, &slot->sl_cred))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment