summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-02-15 22:29:51 -0500
committerDavid S. Miller <davem@davemloft.net>2017-02-15 22:29:51 -0500
commitbf3f14d6342cfb37eab8f0cddd0e4d4063fd9fc9 (patch)
tree2907cdfb8da2c43bf4c599bc3d398274e21dfc91 /net
parent75224c93fa985f4a6fb983f53208f5c5aa555fbf (diff)
rhashtable: Revert nested table changes.
This reverts commits: 6a25478077d987edc5e2f880590a2bc5fcab4441 9dbbfb0ab6680c6a85609041011484e6658e7d3c 40137906c5f55c252194ef5834130383e639536f It's too risky to put in this late in the release cycle. We'll put these changes into the next merge window instead. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/tipc/net.c4
-rw-r--r--net/tipc/socket.c30
2 files changed, 11 insertions, 23 deletions
diff --git a/net/tipc/net.c b/net/tipc/net.c
index ab8a2d5d1e32..28bf4feeb81c 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -110,10 +110,6 @@ int tipc_net_start(struct net *net, u32 addr)
char addr_string[16];
tn->own_addr = addr;
-
- /* Ensure that the new address is visible before we reinit. */
- smp_mb();
-
tipc_named_reinit(net);
tipc_sk_reinit(net);
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 370a5912bcb5..800caaa699a1 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -384,6 +384,8 @@ static int tipc_sk_create(struct net *net, struct socket *sock,
INIT_LIST_HEAD(&tsk->publications);
msg = &tsk->phdr;
tn = net_generic(sock_net(sk), tipc_net_id);
+ tipc_msg_init(tn->own_addr, msg, TIPC_LOW_IMPORTANCE, TIPC_NAMED_MSG,
+ NAMED_H_SIZE, 0);
/* Finish initializing socket data structures */
sock->ops = ops;
@@ -393,13 +395,6 @@ static int tipc_sk_create(struct net *net, struct socket *sock,
pr_warn("Socket create failed; port number exhausted\n");
return -EINVAL;
}
-
- /* Ensure tsk is visible before we read own_addr. */
- smp_mb();
-
- tipc_msg_init(tn->own_addr, msg, TIPC_LOW_IMPORTANCE, TIPC_NAMED_MSG,
- NAMED_H_SIZE, 0);
-
msg_set_origport(msg, tsk->portid);
setup_timer(&sk->sk_timer, tipc_sk_timeout, (unsigned long)tsk);
sk->sk_shutdown = 0;
@@ -2274,27 +2269,24 @@ static int tipc_sk_withdraw(struct tipc_sock *tsk, uint scope,
void tipc_sk_reinit(struct net *net)
{
struct tipc_net *tn = net_generic(net, tipc_net_id);
- struct rhashtable_iter iter;
+ const struct bucket_table *tbl;
+ struct rhash_head *pos;
struct tipc_sock *tsk;
struct tipc_msg *msg;
+ int i;
- rhashtable_walk_enter(&tn->sk_rht, &iter);
-
- do {
- tsk = ERR_PTR(rhashtable_walk_start(&iter));
- if (tsk)
- continue;
-
- while ((tsk = rhashtable_walk_next(&iter)) && !IS_ERR(tsk)) {
+ rcu_read_lock();
+ tbl = rht_dereference_rcu((&tn->sk_rht)->tbl, &tn->sk_rht);
+ for (i = 0; i < tbl->size; i++) {
+ rht_for_each_entry_rcu(tsk, pos, tbl, i, node) {
spin_lock_bh(&tsk->sk.sk_lock.slock);
msg = &tsk->phdr;
msg_set_prevnode(msg, tn->own_addr);
msg_set_orignode(msg, tn->own_addr);
spin_unlock_bh(&tsk->sk.sk_lock.slock);
}
-
- rhashtable_walk_stop(&iter);
- } while (tsk == ERR_PTR(-EAGAIN));
+ }
+ rcu_read_unlock();
}
static struct tipc_sock *tipc_sk_lookup(struct net *net, u32 portid)