]> git.baikalelectronics.ru Git - kernel.git/commit
net: core: netlink: add helper refcount dec and lock function
authorVlad Buslov <vladbu@mellanox.com>
Mon, 24 Sep 2018 16:22:49 +0000 (19:22 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Sep 2018 03:17:35 +0000 (20:17 -0700)
commitf0a2d1d2e243c71525893a33a2a857f0c5b48733
tree67accb6fd62e34b0720d0824d2cdc1076568890c
parent9b0e3af3c69134f9e83bb524a1ef07be23b4f720
net: core: netlink: add helper refcount dec and lock function

Rtnl lock is encapsulated in netlink and cannot be accessed by other
modules directly. This means that reference counted objects that rely on
rtnl lock cannot use it with refcounter helper function that atomically
releases decrements reference and obtains mutex.

This patch implements simple wrapper function around refcount_dec_and_lock
that obtains rtnl lock if reference counter value reached 0.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/rtnetlink.h
net/core/rtnetlink.c