Skip to contentSkip to conversation

batman-adv: Avoid spurious warnings from bat_v neigh_cmp implementation

PATCH In review Sven Eckelmann 2 participants 3 messages Oct 16, 2017 Batman advanced

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 batman-adv: Avoid spurious warnings from bat_v neigh_cmp implementation

The neighbor compare API implementation for B.A.T.M.A.N. V checks whether the neigh_ifinfo for this neighbor on a specific interface exists. A warning is printed when it isn't found.

But it is not called inside a lock which would prevent that this information is lost right before batadv_neigh_ifinfo_get. It must therefore be expected that batadv_v_neigh_(cmp|is_sob) might not be able to get the requested neigh_ifinfo.

A WARN_ON for such a situation seems not to be appropriate because this will only flood the kernel logs. The warnings must therefore be removed.

---
Cc: Antonio Quartulli <[email protected]>

This patch is for https://www.open-mesh.org/issues/343

---
 net/batman-adv/bat_v.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
net/batman-adv/bat_v.c +4 -4
index 93ef1c0..69436d2 100644
@@ -623,11 +623,11 @@ static int batadv_v_neigh_cmp(struct batadv_neigh_node *neigh1,
 	int ret = 0;
 
 	ifinfo1 = batadv_neigh_ifinfo_get(neigh1, if_outgoing1);
-	if (WARN_ON(!ifinfo1))
+	if (!ifinfo1)
 		goto err_ifinfo1;
 
 	ifinfo2 = batadv_neigh_ifinfo_get(neigh2, if_outgoing2);
-	if (WARN_ON(!ifinfo2))
+	if (!ifinfo2)
 		goto err_ifinfo2;
 
 	ret = ifinfo1->bat_v.throughput - ifinfo2->bat_v.throughput;
@@ -649,11 +649,11 @@ static bool batadv_v_neigh_is_sob(struct batadv_neigh_node *neigh1,
 	bool ret = false;
 
 	ifinfo1 = batadv_neigh_ifinfo_get(neigh1, if_outgoing1);
-	if (WARN_ON(!ifinfo1))
+	if (!ifinfo1)
 		goto err_ifinfo1;
 
 	ifinfo2 = batadv_neigh_ifinfo_get(neigh2, if_outgoing2);
-	if (WARN_ON(!ifinfo2))
+	if (!ifinfo2)
 		goto err_ifinfo2;
 
 	threshold = ifinfo1->bat_v.throughput / 4;
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Sven Eckelmann

The neighbor compare API implementation for B.A.T.M.A.N. V checks whether the neigh_ifinfo for this neighbor on a specific interface exists. A warning is printed when it isn't found.

But it is not called inside a lock which would prevent that this information is lost right before batadv_neigh_ifinfo_get. It must therefore be expected that batadv_v_neigh_(cmp|is_sob) might not be able to get the requested neigh_ifinfo.

Quoted 4 lines

A WARN_ON for such a situation seems not to be appropriate because this will only flood the kernel logs. The warnings must therefore be removed.

Yeah, this makes sense. As a read only operation, the lock is not held on purpose, therefore such situation has to be expected.

Signature · 1 line
Antonio Quartulli
#2 lore raw
In reply to Sven Eckelmann
Quoted 9 lines · On Montag, 16. Oktober 2017 09:48:03 CEST Sven Eckelmann wrote:

The neighbor compare API implementation for B.A.T.M.A.N. V checks whether the neigh_ifinfo for this neighbor on a specific interface exists. A warning is printed when it isn't found.

But it is not called inside a lock which would prevent that this information is lost right before batadv_neigh_ifinfo_get. It must therefore be expected that batadv_v_neigh_(cmp|is_sob) might not be able to get the requested neigh_ifinfo.

Quoted 8 lines

A WARN_ON for such a situation seems not to be appropriate because this will only flood the kernel logs. The warnings must therefore be removed.

---
Cc: Antonio Quartulli <[email protected]>

This patch is for https://www.open-mesh.org/issues/343

Patch was applied in 0dee8aba [1]

Kind regards,
Sven

[1] https://git.open-mesh.org/batman-adv.git/commit/0dee8aba4702f82197ed3428ede6b3884fdff5ca