Skip to content

Commit 66364bd

Browse files
Leon Romanovskydavem330
authored andcommitted
rtnetlink: Replace implementation of ASSERT_RTNL() macro with WARN_ONCE()
ASSERT_RTNL() macro is actual open-coded variant of WARN_ONCE() with two exceptions. First, it prints stack for multiple hits and not only once as WARN_ONCE() does. Second, the user can disable prints of WARN_ONCE by setting CONFIG_BUG to N. The multiple prints of dump stack are actually not needed, because calls without rtnl lock are programming errors and user can't do anything about them except to complain to the mailing list after first occurrence of such failure. The user who disabled BUG/WARN prints did it explicitly because by default in upstream kernel and distributions this option is enabled. It means that user doesn't want to see prints about missing locks too. This patch replaces open-coded variant in favor of already existing macro and change error prints to be once only. Reviewed-by: Mark Bloch <markb@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 243dc5f commit 66364bd

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

include/linux/rtnetlink.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,9 @@ void rtnetlink_init(void);
9797
void __rtnl_unlock(void);
9898
void rtnl_kfree_skbs(struct sk_buff *head, struct sk_buff *tail);
9999

100-
#define ASSERT_RTNL() do { \
101-
if (unlikely(!rtnl_is_locked())) { \
102-
printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \
103-
__FILE__, __LINE__); \
104-
dump_stack(); \
105-
} \
106-
} while(0)
100+
#define ASSERT_RTNL() \
101+
WARN_ONCE(!rtnl_is_locked(), \
102+
"RTNL: assertion failed at %s (%d)\n", __FILE__, __LINE__)
107103

108104
extern int ndo_dflt_fdb_dump(struct sk_buff *skb,
109105
struct netlink_callback *cb,

0 commit comments

Comments
 (0)