aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGao Xiang <gaoxiang25@huawei.com>2017-05-10 23:01:15 +0800
committerMister Oyster <oysterized@gmail.com>2017-05-11 17:14:26 +0200
commitedc300b9d345c2be63761852e7d93fc8dac61abe (patch)
treef9b92fb6712de4109b80678ee90bfe832942f3ac
parenta9855526801602656d86c56245e49364e9c015e8 (diff)
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 <gaoxiang25@huawei.com> Change-Id: I84f43c599209d23737c7e28b499dd121cb43636d
-rwxr-xr-xfs/sdcardfs/super.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/sdcardfs/super.c b/fs/sdcardfs/super.c
index a3393e959..8a9c9c7ad 100755
--- 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)
{