Patchwork VFS: call rcu_barrier after kill_sb.

mail settings
Submitter Boaz Harrosh
Date Feb. 9, 2011, 8:26 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/82437/
State Not Applicable
Headers show


Boaz Harrosh - Feb. 9, 2011, 8:26 a.m.
In fa0d7e3, we use rcu free inode instead of freeing the inode
directly. It causes a crash when we rmmod immediately after
we umount the volume[1].

So we need to call rcu_barrier after we kill_sb so that
the inode is freed before we do rmmod. The idea is inspired
by Aneesh Kumar. rcu_barrier will wait for all callbacks
to end before preceding. The original patch was done by
Tao Ma, but synchronize_rcu() is not enough here.


Cc: Nick Piggin <>
Cc: Al Viro <>
Cc: Chris Mason <>
Tested-by: Tao Ma <>
Signed-off-by: Boaz Harrosh <>
 fs/super.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)


diff --git a/fs/super.c b/fs/super.c
index 74e149e..7e9dd4c 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -177,6 +177,11 @@  void deactivate_locked_super(struct super_block *s)
 	struct file_system_type *fs = s->s_type;
 	if (atomic_dec_and_test(&s->s_active)) {
+		/*
+		 * We need to call rcu_barrier so all the delayed rcu free
+		 * inodes are flushed before we release the fs module.
+		 */
+		rcu_barrier();
 	} else {