aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorTom Tucker <tom@opengridcomputing.com>2007-12-30 22:07:34 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2008-02-01 16:42:08 -0500
commitd7979ae4a050a45b78af51832475001b68263d2a (patch)
treef76bf9dea36d03a1141824202015d26002000589 /net/sunrpc
parent323bee32e9bef14c6dd943ecc8e8cd373a9c94d9 (diff)
svc: Move close processing to a single place
Close handling was duplicated in the UDP and TCP recvfrom methods. This code has been moved to the transport independent svc_recv function. Signed-off-by: Tom Tucker <tom@opengridcomputing.com> Acked-by: Neil Brown <neilb@suse.de> Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-by: Greg Banks <gnb@sgi.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/svcsock.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 2007881a5b26..603db98b8fca 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -776,11 +776,6 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
776 return svc_deferred_recv(rqstp); 776 return svc_deferred_recv(rqstp);
777 } 777 }
778 778
779 if (test_bit(SK_CLOSE, &svsk->sk_flags)) {
780 svc_delete_socket(svsk);
781 return 0;
782 }
783
784 clear_bit(SK_DATA, &svsk->sk_flags); 779 clear_bit(SK_DATA, &svsk->sk_flags);
785 skb = NULL; 780 skb = NULL;
786 err = kernel_recvmsg(svsk->sk_sock, &msg, NULL, 781 err = kernel_recvmsg(svsk->sk_sock, &msg, NULL,
@@ -1181,11 +1176,6 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
1181 return svc_deferred_recv(rqstp); 1176 return svc_deferred_recv(rqstp);
1182 } 1177 }
1183 1178
1184 if (test_bit(SK_CLOSE, &svsk->sk_flags)) {
1185 svc_delete_socket(svsk);
1186 return 0;
1187 }
1188
1189 if (svsk->sk_sk->sk_state == TCP_LISTEN) { 1179 if (svsk->sk_sk->sk_state == TCP_LISTEN) {
1190 svc_tcp_accept(svsk); 1180 svc_tcp_accept(svsk);
1191 svc_sock_received(svsk); 1181 svc_sock_received(svsk);
@@ -1311,7 +1301,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
1311 return len; 1301 return len;
1312 1302
1313 err_delete: 1303 err_delete:
1314 svc_delete_socket(svsk); 1304 set_bit(SK_CLOSE, &svsk->sk_flags);
1315 return -EAGAIN; 1305 return -EAGAIN;
1316 1306
1317 error: 1307 error:
@@ -1575,10 +1565,16 @@ svc_recv(struct svc_rqst *rqstp, long timeout)
1575 } 1565 }
1576 spin_unlock_bh(&pool->sp_lock); 1566 spin_unlock_bh(&pool->sp_lock);
1577 1567
1578 dprintk("svc: server %p, pool %u, socket %p, inuse=%d\n", 1568 len = 0;
1579 rqstp, pool->sp_id, svsk, atomic_read(&svsk->sk_inuse)); 1569 if (test_bit(SK_CLOSE, &svsk->sk_flags)) {
1580 len = svsk->sk_xprt.xpt_ops->xpo_recvfrom(rqstp); 1570 dprintk("svc_recv: found SK_CLOSE\n");
1581 dprintk("svc: got len=%d\n", len); 1571 svc_delete_socket(svsk);
1572 } else {
1573 dprintk("svc: server %p, pool %u, socket %p, inuse=%d\n",
1574 rqstp, pool->sp_id, svsk, atomic_read(&svsk->sk_inuse));
1575 len = svsk->sk_xprt.xpt_ops->xpo_recvfrom(rqstp);
1576 dprintk("svc: got len=%d\n", len);
1577 }
1582 1578
1583 /* No data, incomplete (TCP) read, or accept() */ 1579 /* No data, incomplete (TCP) read, or accept() */
1584 if (len == 0 || len == -EAGAIN) { 1580 if (len == 0 || len == -EAGAIN) {