aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/svcauth_unix.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-08-12 03:04:07 -0400
committerJ. Bruce Fields <bfields@redhat.com>2010-09-21 16:57:49 -0400
commit1ebede86b8abbcf8833830e18e05391758cf2f28 (patch)
tree872f1218a45f84070eeac162621ef3e56fc6f222 /net/sunrpc/svcauth_unix.c
parent06497524589f2a7717da33969d541674e0a27da6 (diff)
sunrpc: close connection when a request is irretrievably lost.
If we drop a request in the sunrpc layer, either due kmalloc failure, or due to a cache miss when we could not queue the request for later replay, then close the connection to encourage the client to retry sooner. Note that if the drop happens in the NFS layer, NFSERR_JUKEBOX (aka NFS4ERR_DELAY) is returned to guide the client concerning replay. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/svcauth_unix.c')
-rw-r--r--net/sunrpc/svcauth_unix.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 20731161098..e91b550bc83 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -674,6 +674,8 @@ static struct group_info *unix_gid_find(uid_t uid, struct svc_rqst *rqstp)
674 switch (ret) { 674 switch (ret) {
675 case -ENOENT: 675 case -ENOENT:
676 return ERR_PTR(-ENOENT); 676 return ERR_PTR(-ENOENT);
677 case -ETIMEDOUT:
678 return ERR_PTR(-ESHUTDOWN);
677 case 0: 679 case 0:
678 gi = get_group_info(ug->gi); 680 gi = get_group_info(ug->gi);
679 cache_put(&ug->h, &unix_gid_cache); 681 cache_put(&ug->h, &unix_gid_cache);
@@ -720,8 +722,9 @@ svcauth_unix_set_client(struct svc_rqst *rqstp)
720 switch (cache_check(&ip_map_cache, &ipm->h, &rqstp->rq_chandle)) { 722 switch (cache_check(&ip_map_cache, &ipm->h, &rqstp->rq_chandle)) {
721 default: 723 default:
722 BUG(); 724 BUG();
723 case -EAGAIN:
724 case -ETIMEDOUT: 725 case -ETIMEDOUT:
726 return SVC_CLOSE;
727 case -EAGAIN:
725 return SVC_DROP; 728 return SVC_DROP;
726 case -ENOENT: 729 case -ENOENT:
727 return SVC_DENIED; 730 return SVC_DENIED;
@@ -736,6 +739,8 @@ svcauth_unix_set_client(struct svc_rqst *rqstp)
736 switch (PTR_ERR(gi)) { 739 switch (PTR_ERR(gi)) {
737 case -EAGAIN: 740 case -EAGAIN:
738 return SVC_DROP; 741 return SVC_DROP;
742 case -ESHUTDOWN:
743 return SVC_CLOSE;
739 case -ENOENT: 744 case -ENOENT:
740 break; 745 break;
741 default: 746 default:
@@ -776,7 +781,7 @@ svcauth_null_accept(struct svc_rqst *rqstp, __be32 *authp)
776 cred->cr_gid = (gid_t) -1; 781 cred->cr_gid = (gid_t) -1;
777 cred->cr_group_info = groups_alloc(0); 782 cred->cr_group_info = groups_alloc(0);
778 if (cred->cr_group_info == NULL) 783 if (cred->cr_group_info == NULL)
779 return SVC_DROP; /* kmalloc failure - client must retry */ 784 return SVC_CLOSE; /* kmalloc failure - client must retry */
780 785
781 /* Put NULL verifier */ 786 /* Put NULL verifier */
782 svc_putnl(resv, RPC_AUTH_NULL); 787 svc_putnl(resv, RPC_AUTH_NULL);
@@ -840,7 +845,7 @@ svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp)
840 goto badcred; 845 goto badcred;
841 cred->cr_group_info = groups_alloc(slen); 846 cred->cr_group_info = groups_alloc(slen);
842 if (cred->cr_group_info == NULL) 847 if (cred->cr_group_info == NULL)
843 return SVC_DROP; 848 return SVC_CLOSE;
844 for (i = 0; i < slen; i++) 849 for (i = 0; i < slen; i++)
845 GROUP_AT(cred->cr_group_info, i) = svc_getnl(argv); 850 GROUP_AT(cred->cr_group_info, i) = svc_getnl(argv);
846 if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) { 851 if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) {