* [PATCH] rcu: Fix wrong check in list_splice_init_rcu()
@ 2011-07-19 19:10 Jan H. Schönherr
2011-07-19 20:27 ` Paul E. McKenney
0 siblings, 1 reply; 3+ messages in thread
From: Jan H. Schönherr @ 2011-07-19 19:10 UTC (permalink / raw)
To: Dipankar Sarma, Paul E. McKenney
Cc: Corey Minyard, Chris Mason, linux-kernel, Jan H. Schönherr
Hi.
If I don't miss something obvious, the following patch would
be a good idea.
There are currently two users of list_splice_init_rcu(): IPMI and btrfs.
For these, list_splice_init_rcu() is currently a NOP.
If I interpret the code correctly, this fixes a memory leak for
IPMI and something probably worse for btrfs.
The call from within btrfs was introduced only after v2.6.39 with commit
1f78160 ("Btrfs: using rcu lock in the reader side of devices list") by
converting a list_splice_init() call.
Therefore, this patch might be a candidate for v3.0.
Regards
Jan
----8<----
From: Jan H. Schönherr <schnhrr@cs.tu-berlin.de>
Splicing something into an empty list should work, while there is
nothing to do if the source list is empty.
Signed-off-by: Jan H. Schönherr <schnhrr@cs.tu-berlin.de>
---
include/linux/rculist.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index e3beb31..d079290 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -183,7 +183,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
struct list_head *last = list->prev;
struct list_head *at = head->next;
- if (list_empty(head))
+ if (list_empty(list))
return;
/* "first" and "last" tracking list, so initialize it. */
--
1.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rcu: Fix wrong check in list_splice_init_rcu()
2011-07-19 19:10 [PATCH] rcu: Fix wrong check in list_splice_init_rcu() Jan H. Schönherr
@ 2011-07-19 20:27 ` Paul E. McKenney
2011-07-19 21:00 ` Chris Mason
0 siblings, 1 reply; 3+ messages in thread
From: Paul E. McKenney @ 2011-07-19 20:27 UTC (permalink / raw)
To: Jan H. Schönherr
Cc: Dipankar Sarma, Corey Minyard, Chris Mason, linux-kernel
On Tue, Jul 19, 2011 at 09:10:26PM +0200, Jan H. Schönherr wrote:
> Hi.
>
> If I don't miss something obvious, the following patch would
> be a good idea.
>
> There are currently two users of list_splice_init_rcu(): IPMI and btrfs.
> For these, list_splice_init_rcu() is currently a NOP.
>
> If I interpret the code correctly, this fixes a memory leak for
> IPMI and something probably worse for btrfs.
>
> The call from within btrfs was introduced only after v2.6.39 with commit
> 1f78160 ("Btrfs: using rcu lock in the reader side of devices list") by
> converting a list_splice_init() call.
>
> Therefore, this patch might be a candidate for v3.0.
Excellent catch! This one has been around for some time, so my guess
is that it goes into v3.1. Either way, I have queued it, thank you!
Thanx, Paul
> Regards
> Jan
>
> ----8<----
> From: Jan H. Schönherr <schnhrr@cs.tu-berlin.de>
>
> Splicing something into an empty list should work, while there is
> nothing to do if the source list is empty.
>
> Signed-off-by: Jan H. Schönherr <schnhrr@cs.tu-berlin.de>
> ---
> include/linux/rculist.h | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/rculist.h b/include/linux/rculist.h
> index e3beb31..d079290 100644
> --- a/include/linux/rculist.h
> +++ b/include/linux/rculist.h
> @@ -183,7 +183,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
> struct list_head *last = list->prev;
> struct list_head *at = head->next;
>
> - if (list_empty(head))
> + if (list_empty(list))
> return;
>
> /* "first" and "last" tracking list, so initialize it. */
> --
> 1.7.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rcu: Fix wrong check in list_splice_init_rcu()
2011-07-19 20:27 ` Paul E. McKenney
@ 2011-07-19 21:00 ` Chris Mason
0 siblings, 0 replies; 3+ messages in thread
From: Chris Mason @ 2011-07-19 21:00 UTC (permalink / raw)
To: paulmck; +Cc: Jan H. Schönherr, Dipankar Sarma, Corey Minyard,
linux-kernel
Excerpts from Paul E. McKenney's message of 2011-07-19 16:27:52 -0400:
> On Tue, Jul 19, 2011 at 09:10:26PM +0200, Jan H. Schönherr wrote:
> > Hi.
> >
> > If I don't miss something obvious, the following patch would
> > be a good idea.
> >
> > There are currently two users of list_splice_init_rcu(): IPMI and btrfs.
> > For these, list_splice_init_rcu() is currently a NOP.
> >
> > If I interpret the code correctly, this fixes a memory leak for
> > IPMI and something probably worse for btrfs.
> >
> > The call from within btrfs was introduced only after v2.6.39 with commit
> > 1f78160 ("Btrfs: using rcu lock in the reader side of devices list") by
> > converting a list_splice_init() call.
> >
> > Therefore, this patch might be a candidate for v3.0.
>
> Excellent catch! This one has been around for some time, so my guess
> is that it goes into v3.1. Either way, I have queued it, thank you!
A good catch and thanks for the cc. The btrfs code in question here has
some other problems, and it's fine if this patch doesn't make 3.0.
-chris
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-19 21:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-19 19:10 [PATCH] rcu: Fix wrong check in list_splice_init_rcu() Jan H. Schönherr
2011-07-19 20:27 ` Paul E. McKenney
2011-07-19 21:00 ` Chris Mason
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox