aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2018-03-28 12:18:01 -0400
committerJ. Bruce Fields <bfields@redhat.com>2018-05-11 15:48:57 -0400
commit7e5d0e0de0a01d6aa3a4758dc303c2dcc603e49b (patch)
tree5d2e015211af1983e4d0e6c9e6a7297179d58f6d
parentdac2707227bf35c19f7771e5f19b61bc334b6cd1 (diff)
nfsd: Do not refuse to serve out of cache
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>
-rw-r--r--fs/nfsd/cache.h5
-rw-r--r--fs/nfsd/nfscache.c6
2 files changed, 2 insertions, 9 deletions
diff --git a/fs/nfsd/cache.h b/fs/nfsd/cache.h
index 046b3f048757..b7559c6f2b97 100644
--- a/fs/nfsd/cache.h
+++ b/fs/nfsd/cache.h
@@ -67,11 +67,6 @@ enum {
67 RC_REPLBUFF, 67 RC_REPLBUFF,
68}; 68};
69 69
70/*
71 * If requests are retransmitted within this interval, they're dropped.
72 */
73#define RC_DELAY (HZ/5)
74
75/* Cache entries expire after this time period */ 70/* Cache entries expire after this time period */
76#define RC_EXPIRE (120 * HZ) 71#define RC_EXPIRE (120 * HZ)
77 72
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
index 334f2ad60704..637f87c39183 100644
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@ -394,7 +394,6 @@ nfsd_cache_lookup(struct svc_rqst *rqstp)
394 __wsum csum; 394 __wsum csum;
395 u32 hash = nfsd_cache_hash(xid); 395 u32 hash = nfsd_cache_hash(xid);
396 struct nfsd_drc_bucket *b = &drc_hashtbl[hash]; 396 struct nfsd_drc_bucket *b = &drc_hashtbl[hash];
397 unsigned long age;
398 int type = rqstp->rq_cachetype; 397 int type = rqstp->rq_cachetype;
399 int rtn = RC_DOIT; 398 int rtn = RC_DOIT;
400 399
@@ -461,12 +460,11 @@ nfsd_cache_lookup(struct svc_rqst *rqstp)
461found_entry: 460found_entry:
462 nfsdstats.rchits++; 461 nfsdstats.rchits++;
463 /* We found a matching entry which is either in progress or done. */ 462 /* We found a matching entry which is either in progress or done. */
464 age = jiffies - rp->c_timestamp;
465 lru_put_end(b, rp); 463 lru_put_end(b, rp);
466 464
467 rtn = RC_DROPIT; 465 rtn = RC_DROPIT;
468 /* Request being processed or excessive rexmits */ 466 /* Request being processed */
469 if (rp->c_state == RC_INPROG || age < RC_DELAY) 467 if (rp->c_state == RC_INPROG)
470 goto out; 468 goto out;
471 469
472 /* From the hall of fame of impractical attacks: 470 /* From the hall of fame of impractical attacks: