diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-10-03 13:16:50 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-10-24 23:43:28 -0400 |
commit | cac45b062c67f86dc1d91d675128838773523243 (patch) | |
tree | fcc7dc448d0e14f992794657eae1f052e0826f5a /fs/fat | |
parent | 2e32cf5ef2683a196df24ccd2cd2b4ed735ad9d3 (diff) | |
download | linux-stable-cac45b062c67f86dc1d91d675128838773523243.tar.gz linux-stable-cac45b062c67f86dc1d91d675128838773523243.tar.bz2 linux-stable-cac45b062c67f86dc1d91d675128838773523243.zip |
fat: rcu-delay unloading nls and freeing sbi
makes ->d_hash() and ->d_compare() safety in RCU mode independent
from vfsmount_lock.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/fat')
-rw-r--r-- | fs/fat/fat.h | 1 | ||||
-rw-r--r-- | fs/fat/inode.c | 19 |
2 files changed, 12 insertions, 8 deletions
diff --git a/fs/fat/fat.h b/fs/fat/fat.h index 4241e6f39e86..7c31f4bc74a9 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h @@ -102,6 +102,7 @@ struct msdos_sb_info { struct hlist_head dir_hashtable[FAT_HASH_SIZE]; unsigned int dirty; /* fs state before mount */ + struct rcu_head rcu; }; #define FAT_CACHE_VALID 0 /* special case for valid cache */ diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 0062da21dd8b..854b578f6695 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -548,6 +548,16 @@ static void fat_set_state(struct super_block *sb, brelse(bh); } +static void delayed_free(struct rcu_head *p) +{ + struct msdos_sb_info *sbi = container_of(p, struct msdos_sb_info, rcu); + unload_nls(sbi->nls_disk); + unload_nls(sbi->nls_io); + if (sbi->options.iocharset != fat_default_iocharset) + kfree(sbi->options.iocharset); + kfree(sbi); +} + static void fat_put_super(struct super_block *sb) { struct msdos_sb_info *sbi = MSDOS_SB(sb); @@ -557,14 +567,7 @@ static void fat_put_super(struct super_block *sb) iput(sbi->fsinfo_inode); iput(sbi->fat_inode); - unload_nls(sbi->nls_disk); - unload_nls(sbi->nls_io); - - if (sbi->options.iocharset != fat_default_iocharset) - kfree(sbi->options.iocharset); - - sb->s_fs_info = NULL; - kfree(sbi); + call_rcu(&sbi->rcu, delayed_free); } static struct kmem_cache *fat_inode_cachep; |