From: Gao Xiang Date: Wed, 10 May 2017 15:01:15 +0000 (+0800) Subject: ANDROID: sdcardfs: fix sdcardfs_destroy_inode for the inode RCU approach X-Git-Tag: release-20171130_firefly~4^2~100^2~110 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=28870e9cfa4117213e2f11cf60c32be4164d860d;p=firefly-linux-kernel-4.4.55.git ANDROID: sdcardfs: fix sdcardfs_destroy_inode for the inode RCU approach According to the following commits, fs: icache RCU free inodes vfs: fix the stupidity with i_dentry in inode destructors sdcardfs_destroy_inode should be fixed for the fast path safety. Signed-off-by: Gao Xiang Change-Id: I84f43c599209d23737c7e28b499dd121cb43636d --- diff --git a/fs/sdcardfs/super.c b/fs/sdcardfs/super.c index a3393e959c63..8a9c9c7adca2 100644 --- a/fs/sdcardfs/super.c +++ b/fs/sdcardfs/super.c @@ -192,11 +192,18 @@ static struct inode *sdcardfs_alloc_inode(struct super_block *sb) return &i->vfs_inode; } -static void sdcardfs_destroy_inode(struct inode *inode) +static void i_callback(struct rcu_head *head) { + struct inode *inode = container_of(head, struct inode, i_rcu); + kmem_cache_free(sdcardfs_inode_cachep, SDCARDFS_I(inode)); } +static void sdcardfs_destroy_inode(struct inode *inode) +{ + call_rcu(&inode->i_rcu, i_callback); +} + /* sdcardfs inode cache constructor */ static void init_once(void *obj) {