diff options
author | Ying Xue <ying.xue@windriver.com> | 2012-08-21 07:16:57 +0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-11-21 23:54:31 +0400 |
commit | f288bef46443eb3a0b212c1c57b222c0497e06f6 (patch) | |
tree | 399a156cc2466cfe5526176bac8a0f7e8723a9e8 /net/phonet | |
parent | de4594a51c904ddcd6c3a6cdd100f7c1d94d3239 (diff) | |
download | linux-f288bef46443eb3a0b212c1c57b222c0497e06f6.tar.xz |
tipc: fix race/inefficiencies in poll/wait behaviour
When an application blocks at poll/select on a TIPC socket
while requesting a specific event mask, both the filter_rcv() and
wakeupdispatch() case will wake it up unconditionally whenever
the state changes (i.e an incoming message arrives, or congestion
has subsided). No mask is used.
To avoid this, we populate sk->sk_data_ready and sk->sk_write_space
with tipc_data_ready and tipc_write_space respectively, which makes
tipc more in alignment with the rest of the networking code. These
pass the exact set of possible events to the waker in fs/select.c
hence avoiding waking up blocked processes unnecessarily.
In doing so, we uncover another issue -- that there needs to be a
memory barrier in these poll/receive callbacks, otherwise we are
subject to the the same race as documented above wq_has_sleeper()
[in commit a57de0b4 "net: adding memory barrier to the poll and
receive callbacks"]. So we need to replace poll_wait() with
sock_poll_wait() and use rcu protection for the sk->sk_wq pointer
in these two new functions.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/phonet')
0 files changed, 0 insertions, 0 deletions