• Wei Wang's avatar
    decnet: take dst->__refcnt when struct dn_route is created · 560fd93b
    Wei Wang authored
    struct dn_route is inserted into dn_rt_hash_table but no dst->__refcnt
    is taken.
    This patch makes sure the dn_rt_hash_table's reference to the dst is ref
    counted.
    
    As the dst is always ref counted properly, we can safely mark
    DST_NOGC flag so dst_release() will release dst based on refcnt only.
    And dst gc is no longer needed and all dst_free() or its related
    function calls should be replaced with dst_release() or
    dst_release_immediate(). And dst_dev_put() is called when removing dst
    from the hash table to release the reference on dst->dev before we lose
    pointer to it.
    
    Also, correct the logic in dn_dst_check_expire() and dn_dst_gc() to
    check dst->__refcnt to be > 1 to indicate it is referenced by other
    users.
    Signed-off-by: default avatarWei Wang <weiwan@google.com>
    Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    560fd93b
dn_route.c 47.4 KB