* [Patch net] bridge: resolve a false alarm of lockdep
@ 2017-03-16 17:32 Cong Wang
2017-03-16 17:36 ` Nikolay Aleksandrov
0 siblings, 1 reply; 3+ messages in thread
From: Cong Wang @ 2017-03-16 17:32 UTC (permalink / raw)
To: netdev; +Cc: avagin, Cong Wang
Andrei reported a false alarm of lockdep at net/bridge/br_fdb.c:109,
this is because in Andrei's case, a spin_bug() was already triggered
before this, therefore the debug_locks is turned off, lockdep_is_held()
is no longer accurate after that. We should use lockdep_assert_held_once()
instead of lockdep_is_held() to respect debug_locks.
Reported-by: Andrei Vagin <avagin@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
net/bridge/br_fdb.c | 2 +-
net/bridge/br_private.h | 9 ---------
2 files changed, 1 insertion(+), 10 deletions(-)
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 4f598dc..6e08b71 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -106,7 +106,7 @@ static struct net_bridge_fdb_entry *br_fdb_find(struct net_bridge *br,
struct hlist_head *head = &br->hash[br_mac_hash(addr, vid)];
struct net_bridge_fdb_entry *fdb;
- WARN_ON_ONCE(!br_hash_lock_held(br));
+ lockdep_assert_held_once(&br->hash_lock);
rcu_read_lock();
fdb = fdb_find_rcu(head, addr, vid);
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 2288fca..6136818 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -531,15 +531,6 @@ int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p,
int br_fdb_external_learn_del(struct net_bridge *br, struct net_bridge_port *p,
const unsigned char *addr, u16 vid);
-static inline bool br_hash_lock_held(struct net_bridge *br)
-{
-#ifdef CONFIG_LOCKDEP
- return lockdep_is_held(&br->hash_lock);
-#else
- return true;
-#endif
-}
-
/* br_forward.c */
enum br_pkt_type {
BR_PKT_UNICAST,
--
2.5.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Patch net] bridge: resolve a false alarm of lockdep
2017-03-16 17:32 [Patch net] bridge: resolve a false alarm of lockdep Cong Wang
@ 2017-03-16 17:36 ` Nikolay Aleksandrov
2017-03-17 4:29 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Aleksandrov @ 2017-03-16 17:36 UTC (permalink / raw)
To: Cong Wang, netdev; +Cc: avagin
On 16/03/17 19:32, Cong Wang wrote:
> Andrei reported a false alarm of lockdep at net/bridge/br_fdb.c:109,
> this is because in Andrei's case, a spin_bug() was already triggered
> before this, therefore the debug_locks is turned off, lockdep_is_held()
> is no longer accurate after that. We should use lockdep_assert_held_once()
> instead of lockdep_is_held() to respect debug_locks.
>
> Reported-by: Andrei Vagin <avagin@gmail.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> ---
> net/bridge/br_fdb.c | 2 +-
> net/bridge/br_private.h | 9 ---------
> 2 files changed, 1 insertion(+), 10 deletions(-)
>
Interesting, thanks Cong!
Fixes: 410b3d48f5111 ("bridge: fdb: add proper lock checks in searching functions")
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch net] bridge: resolve a false alarm of lockdep
2017-03-16 17:36 ` Nikolay Aleksandrov
@ 2017-03-17 4:29 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2017-03-17 4:29 UTC (permalink / raw)
To: nikolay; +Cc: xiyou.wangcong, netdev, avagin
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Date: Thu, 16 Mar 2017 19:36:07 +0200
> On 16/03/17 19:32, Cong Wang wrote:
>> Andrei reported a false alarm of lockdep at net/bridge/br_fdb.c:109,
>> this is because in Andrei's case, a spin_bug() was already triggered
>> before this, therefore the debug_locks is turned off, lockdep_is_held()
>> is no longer accurate after that. We should use lockdep_assert_held_once()
>> instead of lockdep_is_held() to respect debug_locks.
>>
>> Reported-by: Andrei Vagin <avagin@gmail.com>
>> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
>> ---
>> net/bridge/br_fdb.c | 2 +-
>> net/bridge/br_private.h | 9 ---------
>> 2 files changed, 1 insertion(+), 10 deletions(-)
>>
>
> Interesting, thanks Cong!
>
> Fixes: 410b3d48f5111 ("bridge: fdb: add proper lock checks in searching functions")
>
> Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-17 4:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-16 17:32 [Patch net] bridge: resolve a false alarm of lockdep Cong Wang
2017-03-16 17:36 ` Nikolay Aleksandrov
2017-03-17 4:29 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).