diff options
author | Christoph Hellwig <hch@lst.de> | 2018-07-30 03:45:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-07-31 15:40:22 -0400 |
commit | e6476c21447c4b17c47e476aade6facf050f31e8 (patch) | |
tree | 894a26efd117c5d984796c47fe8e4c4ed3b41872 /net/socket.c | |
parent | d46eeeaf99bcfab884e3d658e2ba1356939ea783 (diff) |
net: remove bogus RCU annotations on socket.wq
We never use RCU protection for it, just a lot of cargo-cult
rcu_deference_protects calls.
Note that we do keep the kfree_rcu call for it, as the references through
struct sock are RCU protected and thus might require a grace period before
freeing.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/net/socket.c b/net/socket.c index 5b7df6695f4f..475247e347ae 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -251,7 +251,7 @@ static struct inode *sock_alloc_inode(struct super_block *sb) | |||
251 | init_waitqueue_head(&wq->wait); | 251 | init_waitqueue_head(&wq->wait); |
252 | wq->fasync_list = NULL; | 252 | wq->fasync_list = NULL; |
253 | wq->flags = 0; | 253 | wq->flags = 0; |
254 | RCU_INIT_POINTER(ei->socket.wq, wq); | 254 | ei->socket.wq = wq; |
255 | 255 | ||
256 | ei->socket.state = SS_UNCONNECTED; | 256 | ei->socket.state = SS_UNCONNECTED; |
257 | ei->socket.flags = 0; | 257 | ei->socket.flags = 0; |
@@ -265,11 +265,9 @@ static struct inode *sock_alloc_inode(struct super_block *sb) | |||
265 | static void sock_destroy_inode(struct inode *inode) | 265 | static void sock_destroy_inode(struct inode *inode) |
266 | { | 266 | { |
267 | struct socket_alloc *ei; | 267 | struct socket_alloc *ei; |
268 | struct socket_wq *wq; | ||
269 | 268 | ||
270 | ei = container_of(inode, struct socket_alloc, vfs_inode); | 269 | ei = container_of(inode, struct socket_alloc, vfs_inode); |
271 | wq = rcu_dereference_protected(ei->socket.wq, 1); | 270 | kfree_rcu(ei->socket.wq, rcu); |
272 | kfree_rcu(wq, rcu); | ||
273 | kmem_cache_free(sock_inode_cachep, ei); | 271 | kmem_cache_free(sock_inode_cachep, ei); |
274 | } | 272 | } |
275 | 273 | ||
@@ -603,7 +601,7 @@ static void __sock_release(struct socket *sock, struct inode *inode) | |||
603 | module_put(owner); | 601 | module_put(owner); |
604 | } | 602 | } |
605 | 603 | ||
606 | if (rcu_dereference_protected(sock->wq, 1)->fasync_list) | 604 | if (sock->wq->fasync_list) |
607 | pr_err("%s: fasync list not empty!\n", __func__); | 605 | pr_err("%s: fasync list not empty!\n", __func__); |
608 | 606 | ||
609 | if (!sock->file) { | 607 | if (!sock->file) { |
@@ -1181,7 +1179,7 @@ static int sock_fasync(int fd, struct file *filp, int on) | |||
1181 | return -EINVAL; | 1179 | return -EINVAL; |
1182 | 1180 | ||
1183 | lock_sock(sk); | 1181 | lock_sock(sk); |
1184 | wq = rcu_dereference_protected(sock->wq, lockdep_sock_is_held(sk)); | 1182 | wq = sock->wq; |
1185 | fasync_helper(fd, filp, on, &wq->fasync_list); | 1183 | fasync_helper(fd, filp, on, &wq->fasync_list); |
1186 | 1184 | ||
1187 | if (!wq->fasync_list) | 1185 | if (!wq->fasync_list) |