• Ying Xue's avatar
    tipc: rename node create lock to protect node list and hlist · 46651c59
    Ying Xue authored
    When a node is created, tipc_net_lock read lock is first held and
    then node_create_lock is grabbed in order to prevent the same node
    from being created and inserted into both node list and hlist twice.
    But when we query node from the two node lists, we only hold
    tipc_net_lock read lock without grabbing node_create_lock. Obviously
    this locking policy is unable to guarantee that the two node lists
    are always synchronized especially when the operation of changing
    and accessing them occurs in different contexts like currently doing.
    
    Therefore, rename node_create_lock to node_list_lock to protect the
    two node lists, that is, whenever node is inserted into them or node
    is queried from them, the node_list_lock should be always held. As a
    result, tipc_net_lock read lock becomes redundant and then can be
    removed from the node query functions.
    Signed-off-by: default avatarYing Xue <ying.xue@windriver.com>
    Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
    Reviewed-by: default avatarJon Maloy <jon.maloy@ericsson.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    46651c59
node.h 5.09 KB