Commit d7979ae4 authored by Tom Tucker's avatar Tom Tucker Committed by J. Bruce Fields

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: default avatarTom Tucker <tom@opengridcomputing.com>
Acked-by: default avatarNeil Brown <neilb@suse.de>
Reviewed-by: default avatarChuck Lever <chuck.lever@oracle.com>
Reviewed-by: default avatarGreg Banks <gnb@sgi.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
parent 323bee32
...@@ -776,11 +776,6 @@ svc_udp_recvfrom(struct svc_rqst *rqstp) ...@@ -776,11 +776,6 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
return svc_deferred_recv(rqstp); return svc_deferred_recv(rqstp);
} }
if (test_bit(SK_CLOSE, &svsk->sk_flags)) {
svc_delete_socket(svsk);
return 0;
}
clear_bit(SK_DATA, &svsk->sk_flags); clear_bit(SK_DATA, &svsk->sk_flags);
skb = NULL; skb = NULL;
err = kernel_recvmsg(svsk->sk_sock, &msg, NULL, err = kernel_recvmsg(svsk->sk_sock, &msg, NULL,
...@@ -1181,11 +1176,6 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp) ...@@ -1181,11 +1176,6 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
return svc_deferred_recv(rqstp); return svc_deferred_recv(rqstp);
} }
if (test_bit(SK_CLOSE, &svsk->sk_flags)) {
svc_delete_socket(svsk);
return 0;
}
if (svsk->sk_sk->sk_state == TCP_LISTEN) { if (svsk->sk_sk->sk_state == TCP_LISTEN) {
svc_tcp_accept(svsk); svc_tcp_accept(svsk);
svc_sock_received(svsk); svc_sock_received(svsk);
...@@ -1311,7 +1301,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp) ...@@ -1311,7 +1301,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
return len; return len;
err_delete: err_delete:
svc_delete_socket(svsk); set_bit(SK_CLOSE, &svsk->sk_flags);
return -EAGAIN; return -EAGAIN;
error: error:
...@@ -1575,10 +1565,16 @@ svc_recv(struct svc_rqst *rqstp, long timeout) ...@@ -1575,10 +1565,16 @@ svc_recv(struct svc_rqst *rqstp, long timeout)
} }
spin_unlock_bh(&pool->sp_lock); spin_unlock_bh(&pool->sp_lock);
len = 0;
if (test_bit(SK_CLOSE, &svsk->sk_flags)) {
dprintk("svc_recv: found SK_CLOSE\n");
svc_delete_socket(svsk);
} else {
dprintk("svc: server %p, pool %u, socket %p, inuse=%d\n", dprintk("svc: server %p, pool %u, socket %p, inuse=%d\n",
rqstp, pool->sp_id, svsk, atomic_read(&svsk->sk_inuse)); rqstp, pool->sp_id, svsk, atomic_read(&svsk->sk_inuse));
len = svsk->sk_xprt.xpt_ops->xpo_recvfrom(rqstp); len = svsk->sk_xprt.xpt_ops->xpo_recvfrom(rqstp);
dprintk("svc: got len=%d\n", len); dprintk("svc: got len=%d\n", len);
}
/* No data, incomplete (TCP) read, or accept() */ /* No data, incomplete (TCP) read, or accept() */
if (len == 0 || len == -EAGAIN) { if (len == 0 || len == -EAGAIN) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment