> -----Original Message-----
> From: Xue, Ying [mailto:ying....@windriver.com]
> Sent: Tuesday, 16 February, 2016 08:42
> To: Jon Maloy; tipc-discussion@lists.sourceforge.net; Parthasarathy 
> Bhuvaragan;
> Richard Alpe; huzhiji...@gmail.com
> Cc: ma...@donjonn.com
> Subject: RE: [PATCH net-next 1/1] tipc: eliminate risk of finding 
> to-be-deleted
> node instance
> 
> @@ -395,21 +396,19 @@ static void tipc_node_delete(struct tipc_node *node)  {
>       list_del_rcu(&node->list);
>       hlist_del_rcu(&node->hash);
> 
> It's better to move two lines of code above to tipc_node_kref_release(),
> ensuring we remove the node from the two lists only when node is released.

I beg to disagree. This was one of the points with this change; to remove the 
node from the lookup  table as early as possible, to reduce the risk that 
node_find() finds it after it is marked for deletion.  Actually, if I had put a 
synchronize_rcu() after those two lines I believe we would have been completely
safe, but I prefer Jason's suggestion, to use kref_put_if_not_zero().  The risk 
that
this function will ever return zero (false) should now be minimal. Besides, I 
simply
think this is more logical, as I stated in the commit log.

Regards
///jon


> 
> Regards,
> Ying
> 
> -     kfree(node->bc_entry.link);
> -     kfree_rcu(node, rcu);
> +     tipc_node_put(node);
> +     if (del_timer(&node->timer))
> +             tipc_node_put(node);
>  }
> 
>  void tipc_node_stop(struct net *net)
>  {
> -     struct tipc_net *tn = net_generic(net, tipc_net_id);
> +     struct tipc_net *tn = tipc_net(net);
>       struct tipc_node *node, *t_node;
> 
>       spin_lock_bh(&tn->node_list_lock);
> -     list_for_each_entry_safe(node, t_node, &tn->node_list, list) {
> -             if (del_timer(&node->timer))
> -                     tipc_node_put(node);
> -             tipc_node_put(node);
> -     }
> +     list_for_each_entry_safe(node, t_node, &tn->node_list, list)
> +             tipc_node_delete(node);
>       spin_unlock_bh(&tn->node_list_lock);
>  }
> 
> --
> 1.9.1


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

Reply via email to