* [B.A.T.M.A.N.] [PATCH] batman-adv: remove references for global tt entries
@ 2011-10-19 9:02 Simon Wunderlich
2011-10-19 9:20 ` Marek Lindner
2011-10-23 9:40 ` Antonio Quartulli
0 siblings, 2 replies; 6+ messages in thread
From: Simon Wunderlich @ 2011-10-19 9:02 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Simon Wunderlich
struct tt_global_entry holds a reference to an orig_node which must be
decremented before deallocating the structure.
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
---
compat.c | 8 --------
compat.h | 1 -
translation-table.c | 14 +++++++++++++-
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/compat.c b/compat.c
index 88ceb40..1793904 100644
--- a/compat.c
+++ b/compat.c
@@ -36,12 +36,4 @@ void free_rcu_tt_local_entry(struct rcu_head *rcu)
kfree(tt_local_entry);
}
-void free_rcu_tt_global_entry(struct rcu_head *rcu)
-{
- struct tt_global_entry *tt_global_entry;
-
- tt_global_entry = container_of(rcu, struct tt_global_entry, rcu);
- kfree(tt_global_entry);
-}
-
#endif /* < KERNEL_VERSION(3, 0, 0) */
diff --git a/compat.h b/compat.h
index 43654e8..58c3c6a 100644
--- a/compat.h
+++ b/compat.h
@@ -63,7 +63,6 @@ void free_rcu_gw_node(struct rcu_head *rcu);
void free_rcu_neigh_node(struct rcu_head *rcu);
void free_rcu_softif_neigh(struct rcu_head *rcu);
void free_rcu_tt_local_entry(struct rcu_head *rcu);
-void free_rcu_tt_global_entry(struct rcu_head *rcu);
#endif /* < KERNEL_VERSION(3, 0, 0) */
diff --git a/translation-table.c b/translation-table.c
index 873fb3d..abf05cb 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -137,10 +137,22 @@ static void tt_local_entry_free_ref(struct tt_local_entry *tt_local_entry)
kfree_rcu(tt_local_entry, rcu);
}
+static void tt_global_entry_free_rcu(struct rcu_head *rcu)
+{
+ struct tt_global_entry *tt_global_entry;
+
+ tt_global_entry = container_of(rcu, struct tt_global_entry, rcu);
+
+ if (tt_global_entry->orig_node)
+ orig_node_free_ref(tt_global_entry->orig_node);
+
+ kfree(tt_global_entry);
+}
+
static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry)
{
if (atomic_dec_and_test(&tt_global_entry->refcount))
- kfree_rcu(tt_global_entry, rcu);
+ call_rcu(&tt_global_entry->rcu, tt_global_entry_free_rcu);
}
static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,
--
1.7.7
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: remove references for global tt entries
2011-10-19 9:02 [B.A.T.M.A.N.] [PATCH] batman-adv: remove references for global tt entries Simon Wunderlich
@ 2011-10-19 9:20 ` Marek Lindner
2011-10-19 12:08 ` Marek Lindner
2011-10-23 9:40 ` Antonio Quartulli
1 sibling, 1 reply; 6+ messages in thread
From: Marek Lindner @ 2011-10-19 9:20 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Wednesday, October 19, 2011 11:02:25 Simon Wunderlich wrote:
> struct tt_global_entry holds a reference to an orig_node which must be
> decremented before deallocating the structure.
>
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> ---
> compat.c | 8 --------
> compat.h | 1 -
> translation-table.c | 14 +++++++++++++-
> 3 files changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/compat.c b/compat.c
> index 88ceb40..1793904 100644
> --- a/compat.c
> +++ b/compat.c
> @@ -36,12 +36,4 @@ void free_rcu_tt_local_entry(struct rcu_head *rcu)
> kfree(tt_local_entry);
> }
>
> -void free_rcu_tt_global_entry(struct rcu_head *rcu)
> -{
> - struct tt_global_entry *tt_global_entry;
> -
> - tt_global_entry = container_of(rcu, struct tt_global_entry, rcu);
> - kfree(tt_global_entry);
> -}
If you remove the function from compat.c please also remove its declaration in
compat.h.
Thanks,
Marek
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: remove references for global tt entries
2011-10-19 9:20 ` Marek Lindner
@ 2011-10-19 12:08 ` Marek Lindner
0 siblings, 0 replies; 6+ messages in thread
From: Marek Lindner @ 2011-10-19 12:08 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Wednesday, October 19, 2011 11:20:47 Marek Lindner wrote:
> > -void free_rcu_tt_global_entry(struct rcu_head *rcu)
> > -{
> > - struct tt_global_entry *tt_global_entry;
> > -
> > - tt_global_entry = container_of(rcu, struct tt_global_entry, rcu);
> > - kfree(tt_global_entry);
> > -}
>
> If you remove the function from compat.c please also remove its declaration
> in compat.h.
My fault - the compat.h cleanup is there.
Next time I'll read the patch 3 times before commenting. ;-)
Regards,
Marek
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: remove references for global tt entries
2011-10-19 9:02 [B.A.T.M.A.N.] [PATCH] batman-adv: remove references for global tt entries Simon Wunderlich
2011-10-19 9:20 ` Marek Lindner
@ 2011-10-23 9:40 ` Antonio Quartulli
2011-10-23 9:43 ` Alexey Fisher
1 sibling, 1 reply; 6+ messages in thread
From: Antonio Quartulli @ 2011-10-23 9:40 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
Cc: Simon Wunderlich
Hello,
On Wed, Oct 19, 2011 at 11:02:25AM +0200, Simon Wunderlich wrote:
> struct tt_global_entry holds a reference to an orig_node which must be
> decremented before deallocating the structure.
>
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> ---
I got a feedback on IRC from fishor_ who applied the patch while trying to
eliminate the kernel panic problem on module unload. The refcount has not been
printed, therefore we do not know if the patch really corrects it but at least
we know that this patch doesn't crash batman-adv :-)
Cheers,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: remove references for global tt entries
2011-10-23 9:40 ` Antonio Quartulli
@ 2011-10-23 9:43 ` Alexey Fisher
2011-10-24 12:05 ` Marek Lindner
0 siblings, 1 reply; 6+ messages in thread
From: Alexey Fisher @ 2011-10-23 9:43 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
Cc: Simon Wunderlich
On 23.10.2011 11:40, Antonio Quartulli wrote:
> Hello,
>
> On Wed, Oct 19, 2011 at 11:02:25AM +0200, Simon Wunderlich wrote:
>> struct tt_global_entry holds a reference to an orig_node which must be
>> decremented before deallocating the structure.
>>
>> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
>> ---
>
> I got a feedback on IRC from fishor_ who applied the patch while trying to
> eliminate the kernel panic problem on module unload. The refcount has not been
> printed, therefore we do not know if the patch really corrects it but at least
> we know that this patch doesn't crash batman-adv :-)
>
> Cheers,
>
tested-by: Alexey Fisher <bug-track@fisher-privat.net>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: remove references for global tt entries
2011-10-23 9:43 ` Alexey Fisher
@ 2011-10-24 12:05 ` Marek Lindner
0 siblings, 0 replies; 6+ messages in thread
From: Marek Lindner @ 2011-10-24 12:05 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Sunday, October 23, 2011 11:43:05 Alexey Fisher wrote:
> On 23.10.2011 11:40, Antonio Quartulli wrote:
> > Hello,
> >
> > On Wed, Oct 19, 2011 at 11:02:25AM +0200, Simon Wunderlich wrote:
> >> struct tt_global_entry holds a reference to an orig_node which must be
> >> decremented before deallocating the structure.
> >>
> >> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> >> ---
> >
> > I got a feedback on IRC from fishor_ who applied the patch while trying
> > to eliminate the kernel panic problem on module unload. The refcount has
> > not been printed, therefore we do not know if the patch really corrects
> > it but at least we know that this patch doesn't crash batman-adv :-)
> >
> > Cheers,
>
> tested-by: Alexey Fisher <bug-track@fisher-privat.net>
Patch was applied in revision 5da9ad7.
Thanks,
Marek
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-10-24 12:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-19 9:02 [B.A.T.M.A.N.] [PATCH] batman-adv: remove references for global tt entries Simon Wunderlich
2011-10-19 9:20 ` Marek Lindner
2011-10-19 12:08 ` Marek Lindner
2011-10-23 9:40 ` Antonio Quartulli
2011-10-23 9:43 ` Alexey Fisher
2011-10-24 12:05 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox