ANDROID: incremental-fs: remove index and incomplete dir on umount

Cleanup incremental-fs left overs on umount, otherwise incr-fs will
complain as below:

BUG: Dentry {i=47a,n=.incomplete} still in use [unmount of incremental-fs]

This requires vfs_rmdir() of the special index and incomplete dirs.
Also free options.sysfs_name in incfs_mount_fs() instead of in
incfs_free_mount_info() to make it consistent with incfs_remount_fs().

Since set_anon_super() was used in incfs_mount_fs() the incfs_kill_sb()
should use kill_anon_super() instead of generic_shutdown_super()
otherwise it will leak the pseudo dev_t that set_anon_super() allocates.

Bug: 211066171

Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I7ea54db63513fc130e1997cbf79121015ee12405
This commit is contained in:
Tadeusz Struk
2022-01-26 13:09:39 -08:00
committed by Todd Kjos
parent cbac4c1652
commit 6f915dd2af
2 changed files with 7 additions and 3 deletions

View File

@@ -175,7 +175,6 @@ void incfs_free_mount_info(struct mount_info *mi)
kfree(mi->pseudo_file_xattr[i].data); kfree(mi->pseudo_file_xattr[i].data);
kfree(mi->mi_per_uid_read_timeouts); kfree(mi->mi_per_uid_read_timeouts);
incfs_free_sysfs_node(mi->mi_sysfs_node); incfs_free_sysfs_node(mi->mi_sysfs_node);
kfree(mi->mi_options.sysfs_name);
kfree(mi); kfree(mi);
} }

View File

@@ -1855,10 +1855,11 @@ struct dentry *incfs_mount_fs(struct file_system_type *type, int flags,
goto err; goto err;
} }
path_put(&backing_dir_path); mi->mi_backing_dir_path = backing_dir_path;
sb->s_flags |= SB_ACTIVE; sb->s_flags |= SB_ACTIVE;
pr_debug("incfs: mount\n"); pr_debug("incfs: mount\n");
free_options(&options);
return dget(sb->s_root); return dget(sb->s_root);
err: err:
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
@@ -1903,9 +1904,13 @@ out:
void incfs_kill_sb(struct super_block *sb) void incfs_kill_sb(struct super_block *sb)
{ {
struct mount_info *mi = sb->s_fs_info; struct mount_info *mi = sb->s_fs_info;
struct inode *dinode = d_inode(mi->mi_backing_dir_path.dentry);
pr_debug("incfs: unmount\n"); pr_debug("incfs: unmount\n");
generic_shutdown_super(sb); vfs_rmdir(dinode, mi->mi_index_dir);
vfs_rmdir(dinode, mi->mi_incomplete_dir);
kill_anon_super(sb);
incfs_free_mount_info(mi); incfs_free_mount_info(mi);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
} }