Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 8784
b: refs/heads/master
c: 939bb7e
h: refs/heads/master
v: v3
  • Loading branch information
Neil Brown authored and Linus Torvalds committed Sep 13, 2005
1 parent a2b612f commit 78e455a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 45 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 73aea4ecd38ebeff9e322f738057f4ae2c32a3ee
refs/heads/master: 939bb7ef901b2537aa5b4cd819f9c1b25c6a5710
83 changes: 39 additions & 44 deletions trunk/net/sunrpc/svcsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,15 +512,14 @@ svc_sock_setbufsize(struct socket *sock, unsigned int snd, unsigned int rcv)
static void
svc_udp_data_ready(struct sock *sk, int count)
{
struct svc_sock *svsk = (struct svc_sock *)(sk->sk_user_data);
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;

if (!svsk)
goto out;
dprintk("svc: socket %p(inet %p), count=%d, busy=%d\n",
svsk, sk, count, test_bit(SK_BUSY, &svsk->sk_flags));
set_bit(SK_DATA, &svsk->sk_flags);
svc_sock_enqueue(svsk);
out:
if (svsk) {
dprintk("svc: socket %p(inet %p), count=%d, busy=%d\n",
svsk, sk, count, test_bit(SK_BUSY, &svsk->sk_flags));
set_bit(SK_DATA, &svsk->sk_flags);
svc_sock_enqueue(svsk);
}
if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
wake_up_interruptible(sk->sk_sleep);
}
Expand All @@ -540,7 +539,7 @@ svc_write_space(struct sock *sk)
}

if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) {
printk(KERN_WARNING "RPC svc_write_space: some sleeping on %p\n",
dprintk("RPC svc_write_space: someone sleeping on %p\n",
svsk);
wake_up_interruptible(sk->sk_sleep);
}
Expand Down Expand Up @@ -692,31 +691,29 @@ svc_udp_init(struct svc_sock *svsk)
static void
svc_tcp_listen_data_ready(struct sock *sk, int count_unused)
{
struct svc_sock *svsk;
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;

dprintk("svc: socket %p TCP (listen) state change %d\n",
sk, sk->sk_state);
sk, sk->sk_state);

if (sk->sk_state != TCP_LISTEN) {
/*
* This callback may called twice when a new connection
* is established as a child socket inherits everything
* from a parent LISTEN socket.
* 1) data_ready method of the parent socket will be called
* when one of child sockets become ESTABLISHED.
* 2) data_ready method of the child socket may be called
* when it receives data before the socket is accepted.
* In case of 2, we should ignore it silently.
*/
goto out;
}
if (!(svsk = (struct svc_sock *) sk->sk_user_data)) {
printk("svc: socket %p: no user data\n", sk);
goto out;
/*
* This callback may called twice when a new connection
* is established as a child socket inherits everything
* from a parent LISTEN socket.
* 1) data_ready method of the parent socket will be called
* when one of child sockets become ESTABLISHED.
* 2) data_ready method of the child socket may be called
* when it receives data before the socket is accepted.
* In case of 2, we should ignore it silently.
*/
if (sk->sk_state == TCP_LISTEN) {
if (svsk) {
set_bit(SK_CONN, &svsk->sk_flags);
svc_sock_enqueue(svsk);
} else
printk("svc: socket %p: no user data\n", sk);
}
set_bit(SK_CONN, &svsk->sk_flags);
svc_sock_enqueue(svsk);
out:

if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
wake_up_interruptible_all(sk->sk_sleep);
}
Expand All @@ -727,34 +724,32 @@ svc_tcp_listen_data_ready(struct sock *sk, int count_unused)
static void
svc_tcp_state_change(struct sock *sk)
{
struct svc_sock *svsk;
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;

dprintk("svc: socket %p TCP (connected) state change %d (svsk %p)\n",
sk, sk->sk_state, sk->sk_user_data);
sk, sk->sk_state, sk->sk_user_data);

if (!(svsk = (struct svc_sock *) sk->sk_user_data)) {
if (!svsk)
printk("svc: socket %p: no user data\n", sk);
goto out;
else {
set_bit(SK_CLOSE, &svsk->sk_flags);
svc_sock_enqueue(svsk);
}
set_bit(SK_CLOSE, &svsk->sk_flags);
svc_sock_enqueue(svsk);
out:
if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
wake_up_interruptible_all(sk->sk_sleep);
}

static void
svc_tcp_data_ready(struct sock *sk, int count)
{
struct svc_sock * svsk;
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;

dprintk("svc: socket %p TCP data ready (svsk %p)\n",
sk, sk->sk_user_data);
if (!(svsk = (struct svc_sock *)(sk->sk_user_data)))
goto out;
set_bit(SK_DATA, &svsk->sk_flags);
svc_sock_enqueue(svsk);
out:
sk, sk->sk_user_data);
if (svsk) {
set_bit(SK_DATA, &svsk->sk_flags);
svc_sock_enqueue(svsk);
}
if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
wake_up_interruptible(sk->sk_sleep);
}
Expand Down

0 comments on commit 78e455a

Please sign in to comment.