Commit f130c141 authored by James Morris's avatar James Morris

[NETLINK]: Un-duplicate rcv wakeup logic.

parent 7a4ab349
......@@ -585,6 +585,16 @@ void netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code)
read_unlock(&nl_table_lock);
}
static inline void netlink_rcv_wake(struct sock *sk)
{
struct netlink_opt *nlk = nlk_sk(sk);
if (skb_queue_len(&sk->receive_queue) == 0)
clear_bit(0, &nlk->state);
if (!test_bit(0, &nlk->state))
wake_up_interruptible(&nlk->wait);
}
static int netlink_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len,
struct scm_cookie *scm)
......@@ -706,10 +716,7 @@ static int netlink_recvmsg(struct kiocb *iocb, struct socket *sock,
netlink_dump(sk);
out:
if (skb_queue_len(&sk->receive_queue) == 0)
clear_bit(0, &nlk->state);
if (!test_bit(0, &nlk->state))
wake_up_interruptible(&nlk->wait);
netlink_rcv_wake(sk);
return err ? : copied;
}
......@@ -719,11 +726,7 @@ void netlink_data_ready(struct sock *sk, int len)
if (nlk->data_ready)
nlk->data_ready(sk, len);
if (skb_queue_len(&sk->receive_queue) == 0)
clear_bit(0, &nlk->state);
if (!test_bit(0, &nlk->state))
wake_up_interruptible(&nlk->wait);
netlink_rcv_wake(sk);
}
/*
......
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