aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
diff options
context:
space:
mode:
authorTom Herbert <tom@quantonium.net>2017-12-04 13:31:41 -0500
committerDavid S. Miller <davem@davemloft.net>2017-12-11 09:58:38 -0500
commit97a6ec4ac021f7fbec05c15a3aa0c4aaf0461af5 (patch)
tree06f6f0559c003ac7f718d1453120bf21044d7a35 /net/tipc/socket.c
parenta0b586fa75a69578ecf10b40582eed9b35de2432 (diff)
rhashtable: Change rhashtable_walk_start to return void
Most callers of rhashtable_walk_start don't care about a resize event which is indicated by a return value of -EAGAIN. So calls to rhashtable_walk_start are wrapped wih code to ignore -EAGAIN. Something like this is common: ret = rhashtable_walk_start(rhiter); if (ret && ret != -EAGAIN) goto out; Since zero and -EAGAIN are the only possible return values from the function this check is pointless. The condition never evaluates to true. This patch changes rhashtable_walk_start to return void. This simplifies code for the callers that ignore -EAGAIN. For the few cases where the caller cares about the resize event, particularly where the table can be walked in mulitple parts for netlink or seq file dump, the function rhashtable_walk_start_check has been added that returns -EAGAIN on a resize event. Signed-off-by: Tom Herbert <tom@quantonium.net> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r--net/tipc/socket.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 5d18c0caa92b..22c4fd8a9dfe 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -2640,9 +2640,7 @@ void tipc_sk_reinit(struct net *net)
2640 rhashtable_walk_enter(&tn->sk_rht, &iter); 2640 rhashtable_walk_enter(&tn->sk_rht, &iter);
2641 2641
2642 do { 2642 do {
2643 tsk = ERR_PTR(rhashtable_walk_start(&iter)); 2643 rhashtable_walk_start(&iter);
2644 if (IS_ERR(tsk))
2645 goto walk_stop;
2646 2644
2647 while ((tsk = rhashtable_walk_next(&iter)) && !IS_ERR(tsk)) { 2645 while ((tsk = rhashtable_walk_next(&iter)) && !IS_ERR(tsk)) {
2648 spin_lock_bh(&tsk->sk.sk_lock.slock); 2646 spin_lock_bh(&tsk->sk.sk_lock.slock);
@@ -2651,7 +2649,7 @@ void tipc_sk_reinit(struct net *net)
2651 msg_set_orignode(msg, tn->own_addr); 2649 msg_set_orignode(msg, tn->own_addr);
2652 spin_unlock_bh(&tsk->sk.sk_lock.slock); 2650 spin_unlock_bh(&tsk->sk.sk_lock.slock);
2653 } 2651 }
2654walk_stop: 2652
2655 rhashtable_walk_stop(&iter); 2653 rhashtable_walk_stop(&iter);
2656 } while (tsk == ERR_PTR(-EAGAIN)); 2654 } while (tsk == ERR_PTR(-EAGAIN));
2657} 2655}