Commit 66364bdf authored by Leon Romanovsky's avatar Leon Romanovsky Committed by David S. Miller

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: default avatarMark Bloch <markb@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 243dc5fb
...@@ -97,13 +97,9 @@ void rtnetlink_init(void); ...@@ -97,13 +97,9 @@ void rtnetlink_init(void);
void __rtnl_unlock(void); void __rtnl_unlock(void);
void rtnl_kfree_skbs(struct sk_buff *head, struct sk_buff *tail); void rtnl_kfree_skbs(struct sk_buff *head, struct sk_buff *tail);
#define ASSERT_RTNL() do { \ #define ASSERT_RTNL() \
if (unlikely(!rtnl_is_locked())) { \ WARN_ONCE(!rtnl_is_locked(), \
printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \ "RTNL: assertion failed at %s (%d)\n", __FILE__, __LINE__)
__FILE__, __LINE__); \
dump_stack(); \
} \
} while(0)
extern int ndo_dflt_fdb_dump(struct sk_buff *skb, extern int ndo_dflt_fdb_dump(struct sk_buff *skb,
struct netlink_callback *cb, struct netlink_callback *cb,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment