linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: synchronize_rcu when unregister_filesystem success not failure
       [not found]       ` <ext4-masq@mdm.bga.com>
@ 2011-04-14 15:41         ` Milton Miller
  2011-04-14 15:52           ` Linus Torvalds
  0 siblings, 1 reply; 4+ messages in thread
From: Milton Miller @ 2011-04-14 15:41 UTC (permalink / raw)
  To: Nick Piggin, Alexander Viro
  Cc: Linus Torvalds, Dipankar Sarma, Paul E. McKenney, linux-fsdevel,
	linux-kernel

While checking unregister_filesystem for saftey vs extra calls for
"ext4: register ext2 and ext3 alias after ext4" I realized that
the synchronize_rcu() was called on the error path but not on
the success path.

Should we call it in both?
Cc: stable (2.6.38)
Signed-off-by: Milton Miller <miltonm@bga.com>

Index: work.git/fs/filesystems.c
===================================================================
--- work.git.orig/fs/filesystems.c	2011-04-14 10:06:44.360068116 -0500
+++ work.git/fs/filesystems.c	2011-04-14 10:08:41.880061794 -0500
@@ -110,14 +110,13 @@ int unregister_filesystem(struct file_sy
 			*tmp = fs->next;
 			fs->next = NULL;
 			write_unlock(&file_systems_lock);
+			synchronize_rcu();
 			return 0;
 		}
 		tmp = &(*tmp)->next;
 	}
 	write_unlock(&file_systems_lock);
 
-	synchronize_rcu();
-
 	return -EINVAL;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fs: synchronize_rcu when unregister_filesystem success not failure
  2011-04-14 15:41         ` [PATCH] fs: synchronize_rcu when unregister_filesystem success not failure Milton Miller
@ 2011-04-14 15:52           ` Linus Torvalds
  2011-04-14 16:59             ` Marco Stornelli
  2011-04-15  0:49             ` Mark Lord
  0 siblings, 2 replies; 4+ messages in thread
From: Linus Torvalds @ 2011-04-14 15:52 UTC (permalink / raw)
  To: Milton Miller
  Cc: Nick Piggin, Alexander Viro, Dipankar Sarma, Paul E. McKenney,
	linux-fsdevel, linux-kernel

On Thu, Apr 14, 2011 at 8:41 AM, Milton Miller <miltonm@bga.com> wrote:
>
> While checking unregister_filesystem for saftey vs extra calls for
> "ext4: register ext2 and ext3 alias after ext4" I realized that
> the synchronize_rcu() was called on the error path but not on
> the success path.

Good catch.

I think this is the bug that then caused us to do commit d863b50ab013
("vfs: call rcu_barrier after ->kill_sb()")

That said, that commit says that "synchronize_rcu()" isn't enough, and
uses rcu_barrier().

Which _should_ mean that there are no actual users that care about RCU
events by the time you actually hit "unregister_filesystem()".

So I think your patch is correct, but won't actually matter. But maybe
I'm missing something.

> Should we call it in both?

No, I think the success path is the one that would matter.

Comments?

                              Linus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fs: synchronize_rcu when unregister_filesystem success not failure
  2011-04-14 15:52           ` Linus Torvalds
@ 2011-04-14 16:59             ` Marco Stornelli
  2011-04-15  0:49             ` Mark Lord
  1 sibling, 0 replies; 4+ messages in thread
From: Marco Stornelli @ 2011-04-14 16:59 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Milton Miller, Nick Piggin, Alexander Viro, Dipankar Sarma,
	Paul E. McKenney, linux-fsdevel, linux-kernel

Il 14/04/2011 17:52, Linus Torvalds ha scritto:
> On Thu, Apr 14, 2011 at 8:41 AM, Milton Miller<miltonm@bga.com>  wrote:
>>
>> While checking unregister_filesystem for saftey vs extra calls for
>> "ext4: register ext2 and ext3 alias after ext4" I realized that
>> the synchronize_rcu() was called on the error path but not on
>> the success path.
>
> Good catch.
>
> I think this is the bug that then caused us to do commit d863b50ab013
> ("vfs: call rcu_barrier after ->kill_sb()")
>
> That said, that commit says that "synchronize_rcu()" isn't enough, and
> uses rcu_barrier().
>
> Which _should_ mean that there are no actual users that care about RCU
> events by the time you actually hit "unregister_filesystem()".
>
> So I think your patch is correct, but won't actually matter. But maybe
> I'm missing something.
>
>> Should we call it in both?
>
> No, I think the success path is the one that would matter.
>
> Comments?
>

If I well remember the rcu_barrier was needed for the fs module 
unloading problem. In that case synchronize_rcu() wasn't enough. That 
said, I agree with you, it won't have any impact.

Marco

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fs: synchronize_rcu when unregister_filesystem success not failure
  2011-04-14 15:52           ` Linus Torvalds
  2011-04-14 16:59             ` Marco Stornelli
@ 2011-04-15  0:49             ` Mark Lord
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Lord @ 2011-04-15  0:49 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Milton Miller, Nick Piggin, Alexander Viro, Dipankar Sarma,
	Paul E. McKenney, linux-fsdevel, linux-kernel

On 11-04-14 11:52 AM, Linus Torvalds wrote:
> On Thu, Apr 14, 2011 at 8:41 AM, Milton Miller <miltonm@bga.com> wrote:
>>
>> While checking unregister_filesystem for saftey vs extra calls for
>> "ext4: register ext2 and ext3 alias after ext4" I realized that
>> the synchronize_rcu() was called on the error path but not on
>> the success path.
> 
> Good catch.
> 
> I think this is the bug that then caused us to do commit d863b50ab013
> ("vfs: call rcu_barrier after ->kill_sb()")
> 
> That said, that commit says that "synchronize_rcu()" isn't enough, and
> uses rcu_barrier().
> 
> Which _should_ mean that there are no actual users that care about RCU
> events by the time you actually hit "unregister_filesystem()".

Is that true of older kernels?  (eg. 2.6.38 has the same bug)

IOW, is this a -stable candidate?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-15  0:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <4DA48AF4.5080803@teksavvy.com>
     [not found] ` <20110413004938.GE3682@thunk.org>
     [not found]   ` <4DA5ADA6.5060301@teksavvy.com>
     [not found]     ` <5A35771F-49B6-491E-B012-DBE68907E382@mit.edu>
     [not found]       ` <ext4-masq@mdm.bga.com>
2011-04-14 15:41         ` [PATCH] fs: synchronize_rcu when unregister_filesystem success not failure Milton Miller
2011-04-14 15:52           ` Linus Torvalds
2011-04-14 16:59             ` Marco Stornelli
2011-04-15  0:49             ` Mark Lord

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).