Skip to content

Commit

Permalink
nfsd: Do not refuse to serve out of cache
Browse files Browse the repository at this point in the history
Currently the knfsd replay cache appears to try to refuse replying to
retries that come within 200ms of the cache entry being created. That
makes limited sense in today's world of high speed TCP.

After a TCP disconnection, a client can very easily reconnect and retry
an rpc in less than 200ms.  If this logic drops that retry, however, the
client may be quite slow to retry again.  This logic is original to the
first reply cache implementation in 2.1, and may have made more sense
for UDP clients that retried much more frequently.

After this patch we will still drop on finding the original request
still in progress.  We may want to fix that as well at some point,
though it's less likely.

Note that svc_check_conn_limits is often the cause of those
disconnections.  We may want to fix that some day.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Acked-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
  • Loading branch information
trondmypd authored and J. Bruce Fields committed May 11, 2018
1 parent dac2707 commit 7e5d0e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
5 changes: 0 additions & 5 deletions fs/nfsd/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ enum {
RC_REPLBUFF,
};

/*
* If requests are retransmitted within this interval, they're dropped.
*/
#define RC_DELAY (HZ/5)

/* Cache entries expire after this time period */
#define RC_EXPIRE (120 * HZ)

Expand Down
6 changes: 2 additions & 4 deletions fs/nfsd/nfscache.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ nfsd_cache_lookup(struct svc_rqst *rqstp)
__wsum csum;
u32 hash = nfsd_cache_hash(xid);
struct nfsd_drc_bucket *b = &drc_hashtbl[hash];
unsigned long age;
int type = rqstp->rq_cachetype;
int rtn = RC_DOIT;

Expand Down Expand Up @@ -461,12 +460,11 @@ nfsd_cache_lookup(struct svc_rqst *rqstp)
found_entry:
nfsdstats.rchits++;
/* We found a matching entry which is either in progress or done. */
age = jiffies - rp->c_timestamp;
lru_put_end(b, rp);

rtn = RC_DROPIT;
/* Request being processed or excessive rexmits */
if (rp->c_state == RC_INPROG || age < RC_DELAY)
/* Request being processed */
if (rp->c_state == RC_INPROG)
goto out;

/* From the hall of fame of impractical attacks:
Expand Down

0 comments on commit 7e5d0e0

Please sign in to comment.