From 7f4eab0e0a02c586b53466dc016f1bbd7b17b69e Mon Sep 17 00:00:00 2001 From: Andrea Arcangeli Date: Tue, 10 Oct 2017 23:47:52 +0200 Subject: sdcardfs: fix space leak Don't keep looked up dentries around because there's no notification when the lowerfs unlinks an inode, to collect the upper dentry cache so the lower inode reference can be released and the storage space released. This effectively disables the dcache lookups but it should still be much faster than fuse sdcardfs. The alternative is to add a notification mechanism to keep two separate dcache layers in sync which isn't trivial, or stop ever touching the lower fs and remove that path.replace from VolumeInfo.java. Change-Id: I211bd676834126f6f65b3d09ebe951d0375d7985 Signed-off-by: Kevin F. Haggerty --- fs/sdcardfs/dentry.c | 6 ++++++ 1 file changed, 6 insertions(+) mode change 100755 => 100644 fs/sdcardfs/dentry.c diff --git a/fs/sdcardfs/dentry.c b/fs/sdcardfs/dentry.c old mode 100755 new mode 100644 index c8f3bcbfb..80e753d23 --- a/fs/sdcardfs/dentry.c +++ b/fs/sdcardfs/dentry.c @@ -185,7 +185,13 @@ static void sdcardfs_canonical_path(const struct path *path, sdcardfs_get_real_lower(path->dentry, actual_path); } +static int sdcardfs_d_delete(const struct dentry * dentry) +{ + return dentry->d_inode && !S_ISDIR(dentry->d_inode->i_mode); +} + const struct dentry_operations sdcardfs_ci_dops = { + .d_delete = sdcardfs_d_delete, .d_revalidate = sdcardfs_d_revalidate, .d_release = sdcardfs_d_release, .d_hash = sdcardfs_hash_ci, -- cgit v1.2.3