diff options
Diffstat (limited to 'net/sunrpc/svc_xprt.c')
-rw-r--r-- | net/sunrpc/svc_xprt.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 7d1f9e928f69..8f0f1fb3dc52 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
@@ -173,11 +173,13 @@ static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl, | |||
173 | .sin_addr.s_addr = htonl(INADDR_ANY), | 173 | .sin_addr.s_addr = htonl(INADDR_ANY), |
174 | .sin_port = htons(port), | 174 | .sin_port = htons(port), |
175 | }; | 175 | }; |
176 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
176 | struct sockaddr_in6 sin6 = { | 177 | struct sockaddr_in6 sin6 = { |
177 | .sin6_family = AF_INET6, | 178 | .sin6_family = AF_INET6, |
178 | .sin6_addr = IN6ADDR_ANY_INIT, | 179 | .sin6_addr = IN6ADDR_ANY_INIT, |
179 | .sin6_port = htons(port), | 180 | .sin6_port = htons(port), |
180 | }; | 181 | }; |
182 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | ||
181 | struct sockaddr *sap; | 183 | struct sockaddr *sap; |
182 | size_t len; | 184 | size_t len; |
183 | 185 | ||
@@ -186,10 +188,12 @@ static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl, | |||
186 | sap = (struct sockaddr *)&sin; | 188 | sap = (struct sockaddr *)&sin; |
187 | len = sizeof(sin); | 189 | len = sizeof(sin); |
188 | break; | 190 | break; |
191 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
189 | case PF_INET6: | 192 | case PF_INET6: |
190 | sap = (struct sockaddr *)&sin6; | 193 | sap = (struct sockaddr *)&sin6; |
191 | len = sizeof(sin6); | 194 | len = sizeof(sin6); |
192 | break; | 195 | break; |
196 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | ||
193 | default: | 197 | default: |
194 | return ERR_PTR(-EAFNOSUPPORT); | 198 | return ERR_PTR(-EAFNOSUPPORT); |
195 | } | 199 | } |
@@ -231,7 +235,10 @@ int svc_create_xprt(struct svc_serv *serv, const char *xprt_name, | |||
231 | err: | 235 | err: |
232 | spin_unlock(&svc_xprt_class_lock); | 236 | spin_unlock(&svc_xprt_class_lock); |
233 | dprintk("svc: transport %s not found\n", xprt_name); | 237 | dprintk("svc: transport %s not found\n", xprt_name); |
234 | return -ENOENT; | 238 | |
239 | /* This errno is exposed to user space. Provide a reasonable | ||
240 | * perror msg for a bad transport. */ | ||
241 | return -EPROTONOSUPPORT; | ||
235 | } | 242 | } |
236 | EXPORT_SYMBOL_GPL(svc_create_xprt); | 243 | EXPORT_SYMBOL_GPL(svc_create_xprt); |
237 | 244 | ||
@@ -699,8 +706,10 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) | |||
699 | spin_unlock_bh(&pool->sp_lock); | 706 | spin_unlock_bh(&pool->sp_lock); |
700 | 707 | ||
701 | len = 0; | 708 | len = 0; |
702 | if (test_bit(XPT_LISTENER, &xprt->xpt_flags) && | 709 | if (test_bit(XPT_CLOSE, &xprt->xpt_flags)) { |
703 | !test_bit(XPT_CLOSE, &xprt->xpt_flags)) { | 710 | dprintk("svc_recv: found XPT_CLOSE\n"); |
711 | svc_delete_xprt(xprt); | ||
712 | } else if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) { | ||
704 | struct svc_xprt *newxpt; | 713 | struct svc_xprt *newxpt; |
705 | newxpt = xprt->xpt_ops->xpo_accept(xprt); | 714 | newxpt = xprt->xpt_ops->xpo_accept(xprt); |
706 | if (newxpt) { | 715 | if (newxpt) { |
@@ -726,7 +735,7 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) | |||
726 | svc_xprt_received(newxpt); | 735 | svc_xprt_received(newxpt); |
727 | } | 736 | } |
728 | svc_xprt_received(xprt); | 737 | svc_xprt_received(xprt); |
729 | } else if (!test_bit(XPT_CLOSE, &xprt->xpt_flags)) { | 738 | } else { |
730 | dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n", | 739 | dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n", |
731 | rqstp, pool->sp_id, xprt, | 740 | rqstp, pool->sp_id, xprt, |
732 | atomic_read(&xprt->xpt_ref.refcount)); | 741 | atomic_read(&xprt->xpt_ref.refcount)); |
@@ -739,11 +748,6 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) | |||
739 | dprintk("svc: got len=%d\n", len); | 748 | dprintk("svc: got len=%d\n", len); |
740 | } | 749 | } |
741 | 750 | ||
742 | if (test_bit(XPT_CLOSE, &xprt->xpt_flags)) { | ||
743 | dprintk("svc_recv: found XPT_CLOSE\n"); | ||
744 | svc_delete_xprt(xprt); | ||
745 | } | ||
746 | |||
747 | /* No data, incomplete (TCP) read, or accept() */ | 751 | /* No data, incomplete (TCP) read, or accept() */ |
748 | if (len == 0 || len == -EAGAIN) { | 752 | if (len == 0 || len == -EAGAIN) { |
749 | rqstp->rq_res.len = 0; | 753 | rqstp->rq_res.len = 0; |
@@ -889,11 +893,8 @@ void svc_delete_xprt(struct svc_xprt *xprt) | |||
889 | if (test_bit(XPT_TEMP, &xprt->xpt_flags)) | 893 | if (test_bit(XPT_TEMP, &xprt->xpt_flags)) |
890 | serv->sv_tmpcnt--; | 894 | serv->sv_tmpcnt--; |
891 | 895 | ||
892 | for (dr = svc_deferred_dequeue(xprt); dr; | 896 | while ((dr = svc_deferred_dequeue(xprt)) != NULL) |
893 | dr = svc_deferred_dequeue(xprt)) { | ||
894 | svc_xprt_put(xprt); | ||
895 | kfree(dr); | 897 | kfree(dr); |
896 | } | ||
897 | 898 | ||
898 | svc_xprt_put(xprt); | 899 | svc_xprt_put(xprt); |
899 | spin_unlock_bh(&serv->sv_lock); | 900 | spin_unlock_bh(&serv->sv_lock); |