aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorJ.Bruce Fields <bfields@fieldses.org>2006-12-13 03:35:25 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-13 12:05:54 -0500
commite0bb89ef031f76dcb9c9d920d18b13948f1418da (patch)
tree6016032b160db2cf697eea19cd0f12ace946c7cc /net/sunrpc
parent021d3a72459191a76e8e482ee4937ba6bc9fd712 (diff)
[PATCH] knfsd: nfsd: don't drop silently on upcall deferral
To avoid tying up server threads when nfsd makes an upcall (to mountd, to get export options, to idmapd, for nfsv4 name<->id mapping, etc.), we temporarily "drop" the request and save enough information so that we can revisit it later. Certain failures during the deferral process can cause us to really drop the request and never revisit it. This is often less than ideal, and is unacceptable in the NFSv4 case--rfc 3530 forbids the server from dropping a request without also closing the connection. As a first step, we modify the deferral code to return -ETIMEDOUT (which is translated to nfserr_jukebox in the v3 and v4 cases, and remains a drop in the v2 case). Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/auth_gss/svcauth_gss.c2
-rw-r--r--net/sunrpc/cache.c11
-rw-r--r--net/sunrpc/svcauth_unix.c1
3 files changed, 9 insertions, 5 deletions
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 3bf3520f92d1..066c64a97fd8 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -1066,7 +1066,7 @@ svcauth_gss_accept(struct svc_rqst *rqstp, __be32 *authp)
1066 } 1066 }
1067 switch(cache_check(&rsi_cache, &rsip->h, &rqstp->rq_chandle)) { 1067 switch(cache_check(&rsi_cache, &rsip->h, &rqstp->rq_chandle)) {
1068 case -EAGAIN: 1068 case -EAGAIN:
1069 goto drop; 1069 case -ETIMEDOUT:
1070 case -ENOENT: 1070 case -ENOENT:
1071 goto drop; 1071 goto drop;
1072 case 0: 1072 case 0:
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 80aff0474572..824e8534e022 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -34,7 +34,7 @@
34 34
35#define RPCDBG_FACILITY RPCDBG_CACHE 35#define RPCDBG_FACILITY RPCDBG_CACHE
36 36
37static void cache_defer_req(struct cache_req *req, struct cache_head *item); 37static int cache_defer_req(struct cache_req *req, struct cache_head *item);
38static void cache_revisit_request(struct cache_head *item); 38static void cache_revisit_request(struct cache_head *item);
39 39
40static void cache_init(struct cache_head *h) 40static void cache_init(struct cache_head *h)
@@ -185,6 +185,7 @@ static int cache_make_upcall(struct cache_detail *detail, struct cache_head *h);
185 * 185 *
186 * Returns 0 if the cache_head can be used, or cache_puts it and returns 186 * Returns 0 if the cache_head can be used, or cache_puts it and returns
187 * -EAGAIN if upcall is pending, 187 * -EAGAIN if upcall is pending,
188 * -ETIMEDOUT if upcall failed and should be retried,
188 * -ENOENT if cache entry was negative 189 * -ENOENT if cache entry was negative
189 */ 190 */
190int cache_check(struct cache_detail *detail, 191int cache_check(struct cache_detail *detail,
@@ -236,7 +237,8 @@ int cache_check(struct cache_detail *detail,
236 } 237 }
237 238
238 if (rv == -EAGAIN) 239 if (rv == -EAGAIN)
239 cache_defer_req(rqstp, h); 240 if (cache_defer_req(rqstp, h) != 0)
241 rv = -ETIMEDOUT;
240 242
241 if (rv) 243 if (rv)
242 cache_put(h, detail); 244 cache_put(h, detail);
@@ -523,14 +525,14 @@ static LIST_HEAD(cache_defer_list);
523static struct list_head cache_defer_hash[DFR_HASHSIZE]; 525static struct list_head cache_defer_hash[DFR_HASHSIZE];
524static int cache_defer_cnt; 526static int cache_defer_cnt;
525 527
526static void cache_defer_req(struct cache_req *req, struct cache_head *item) 528static int cache_defer_req(struct cache_req *req, struct cache_head *item)
527{ 529{
528 struct cache_deferred_req *dreq; 530 struct cache_deferred_req *dreq;
529 int hash = DFR_HASH(item); 531 int hash = DFR_HASH(item);
530 532
531 dreq = req->defer(req); 533 dreq = req->defer(req);
532 if (dreq == NULL) 534 if (dreq == NULL)
533 return; 535 return -ETIMEDOUT;
534 536
535 dreq->item = item; 537 dreq->item = item;
536 dreq->recv_time = get_seconds(); 538 dreq->recv_time = get_seconds();
@@ -571,6 +573,7 @@ static void cache_defer_req(struct cache_req *req, struct cache_head *item)
571 /* must have just been validated... */ 573 /* must have just been validated... */
572 cache_revisit_request(item); 574 cache_revisit_request(item);
573 } 575 }
576 return 0;
574} 577}
575 578
576static void cache_revisit_request(struct cache_head *item) 579static void cache_revisit_request(struct cache_head *item)
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index a0a953a430c2..177f81608cfb 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -435,6 +435,7 @@ svcauth_unix_set_client(struct svc_rqst *rqstp)
435 default: 435 default:
436 BUG(); 436 BUG();
437 case -EAGAIN: 437 case -EAGAIN:
438 case -ETIMEDOUT:
438 return SVC_DROP; 439 return SVC_DROP;
439 case -ENOENT: 440 case -ENOENT:
440 return SVC_DENIED; 441 return SVC_DENIED;