aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/svcsock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/svcsock.c')
-rw-r--r--net/sunrpc/svcsock.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index b6e59f0a9475..43bcb4699d69 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -60,7 +60,7 @@
60 60
61static struct svc_sock *svc_setup_socket(struct svc_serv *, struct socket *, 61static struct svc_sock *svc_setup_socket(struct svc_serv *, struct socket *,
62 int flags); 62 int flags);
63static void svc_udp_data_ready(struct sock *, int); 63static void svc_udp_data_ready(struct sock *);
64static int svc_udp_recvfrom(struct svc_rqst *); 64static int svc_udp_recvfrom(struct svc_rqst *);
65static int svc_udp_sendto(struct svc_rqst *); 65static int svc_udp_sendto(struct svc_rqst *);
66static void svc_sock_detach(struct svc_xprt *); 66static void svc_sock_detach(struct svc_xprt *);
@@ -403,14 +403,14 @@ static void svc_sock_setbufsize(struct socket *sock, unsigned int snd,
403/* 403/*
404 * INET callback when data has been received on the socket. 404 * INET callback when data has been received on the socket.
405 */ 405 */
406static void svc_udp_data_ready(struct sock *sk, int count) 406static void svc_udp_data_ready(struct sock *sk)
407{ 407{
408 struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; 408 struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
409 wait_queue_head_t *wq = sk_sleep(sk); 409 wait_queue_head_t *wq = sk_sleep(sk);
410 410
411 if (svsk) { 411 if (svsk) {
412 dprintk("svc: socket %p(inet %p), count=%d, busy=%d\n", 412 dprintk("svc: socket %p(inet %p), busy=%d\n",
413 svsk, sk, count, 413 svsk, sk,
414 test_bit(XPT_BUSY, &svsk->sk_xprt.xpt_flags)); 414 test_bit(XPT_BUSY, &svsk->sk_xprt.xpt_flags));
415 set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); 415 set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags);
416 svc_xprt_enqueue(&svsk->sk_xprt); 416 svc_xprt_enqueue(&svsk->sk_xprt);
@@ -731,7 +731,7 @@ static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv)
731 * A data_ready event on a listening socket means there's a connection 731 * A data_ready event on a listening socket means there's a connection
732 * pending. Do not use state_change as a substitute for it. 732 * pending. Do not use state_change as a substitute for it.
733 */ 733 */
734static void svc_tcp_listen_data_ready(struct sock *sk, int count_unused) 734static void svc_tcp_listen_data_ready(struct sock *sk)
735{ 735{
736 struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; 736 struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
737 wait_queue_head_t *wq; 737 wait_queue_head_t *wq;
@@ -783,7 +783,7 @@ static void svc_tcp_state_change(struct sock *sk)
783 wake_up_interruptible_all(wq); 783 wake_up_interruptible_all(wq);
784} 784}
785 785
786static void svc_tcp_data_ready(struct sock *sk, int count) 786static void svc_tcp_data_ready(struct sock *sk)
787{ 787{
788 struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; 788 struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
789 wait_queue_head_t *wq = sk_sleep(sk); 789 wait_queue_head_t *wq = sk_sleep(sk);
@@ -1397,6 +1397,22 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
1397 return svsk; 1397 return svsk;
1398} 1398}
1399 1399
1400bool svc_alien_sock(struct net *net, int fd)
1401{
1402 int err;
1403 struct socket *sock = sockfd_lookup(fd, &err);
1404 bool ret = false;
1405
1406 if (!sock)
1407 goto out;
1408 if (sock_net(sock->sk) != net)
1409 ret = true;
1410 sockfd_put(sock);
1411out:
1412 return ret;
1413}
1414EXPORT_SYMBOL_GPL(svc_alien_sock);
1415
1400/** 1416/**
1401 * svc_addsock - add a listener socket to an RPC service 1417 * svc_addsock - add a listener socket to an RPC service
1402 * @serv: pointer to RPC service to which to add a new listener 1418 * @serv: pointer to RPC service to which to add a new listener