Skip to content

Commit

Permalink
vfs: call rcu_barrier after ->kill_sb()
Browse files Browse the repository at this point in the history
In commit fa0d7e3 ("fs: icache RCU free inodes"), 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.

1. http://marc.info/?l=linux-fsdevel&m=129680863330185&w=2

Tested-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Cc: Nick Piggin <npiggin@kernel.dk>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Boaz Harrosh authored and Linus Torvalds committed Feb 12, 2011
1 parent 2dab597 commit d863b50
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
fs->kill_sb(s);
/*
* We need to call rcu_barrier so all the delayed rcu free
* inodes are flushed before we release the fs module.
*/
rcu_barrier();
put_filesystem(fs);
put_super(s);
} else {
Expand Down

0 comments on commit d863b50

Please sign in to comment.