Revert "ANDROID: incremental-fs: fix mount_fs issue"
This reverts three increment-fs commits:d5faa13b5910412e10c67ad88c9349This is to fix the incrementalinstall test. Can now install the same apk twice, and repeated installs are stable. Bug: 217661925 Bug: 219731048 Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org> Change-Id: Ia8488d728218881ed17e4d68cab21b0b152e3ca4
This commit is contained in:
@@ -43,8 +43,7 @@ static int dir_link(struct dentry *old_dentry, struct inode *dir,
|
||||
struct dentry *new_dentry);
|
||||
static int dir_rmdir(struct inode *dir, struct dentry *dentry);
|
||||
static int dir_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct inode *new_dir, struct dentry *new_dentry,
|
||||
unsigned int flags);
|
||||
struct inode *new_dir, struct dentry *new_dentry);
|
||||
|
||||
static int file_open(struct inode *inode, struct file *file);
|
||||
static int file_release(struct inode *inode, struct file *file);
|
||||
@@ -87,7 +86,7 @@ static int dir_rename_wrap(struct user_namespace *ns, struct inode *old_dir,
|
||||
struct dentry *old_dentry, struct inode *new_dir,
|
||||
struct dentry *new_dentry, unsigned int flags)
|
||||
{
|
||||
return dir_rename(old_dir, old_dentry, new_dir, new_dentry, flags);
|
||||
return dir_rename(old_dir, old_dentry, new_dir, new_dentry);
|
||||
}
|
||||
|
||||
static const struct inode_operations incfs_dir_inode_ops = {
|
||||
@@ -399,7 +398,7 @@ static int iterate_incfs_dir(struct file *file, struct dir_context *ctx)
|
||||
struct mount_info *mi = get_mount_info(file_superblock(file));
|
||||
bool root;
|
||||
|
||||
if (!dir || !mi) {
|
||||
if (!dir) {
|
||||
error = -EBADF;
|
||||
goto out;
|
||||
}
|
||||
@@ -1331,8 +1330,7 @@ path_err:
|
||||
}
|
||||
|
||||
static int dir_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct inode *new_dir, struct dentry *new_dentry,
|
||||
unsigned int flags)
|
||||
struct inode *new_dir, struct dentry *new_dentry)
|
||||
{
|
||||
struct mount_info *mi = get_mount_info(old_dir->i_sb);
|
||||
struct dentry *backing_old_dentry;
|
||||
@@ -1344,9 +1342,6 @@ static int dir_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct renamedata rd = {};
|
||||
int error = 0;
|
||||
|
||||
if (!mi)
|
||||
return -EBADF;
|
||||
|
||||
error = mutex_lock_interruptible(&mi->mi_dir_struct_mutex);
|
||||
if (error)
|
||||
return error;
|
||||
@@ -1390,11 +1385,6 @@ static int dir_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
rd.old_dentry = backing_old_dentry;
|
||||
rd.new_dir = d_inode(backing_new_dir_dentry);
|
||||
rd.new_dentry = backing_new_dentry;
|
||||
rd.flags = flags;
|
||||
rd.old_mnt_userns = &init_user_ns;
|
||||
rd.new_mnt_userns = &init_user_ns;
|
||||
rd.delegated_inode = NULL;
|
||||
|
||||
error = vfs_rename(&rd);
|
||||
if (error)
|
||||
goto unlock_out;
|
||||
@@ -1683,9 +1673,6 @@ static ssize_t incfs_getxattr(struct dentry *d, const char *name,
|
||||
size_t stored_size;
|
||||
int i;
|
||||
|
||||
if (!mi)
|
||||
return -EBADF;
|
||||
|
||||
if (di && di->backing_path.dentry)
|
||||
return vfs_getxattr(&init_user_ns, di->backing_path.dentry, name, value, size);
|
||||
|
||||
@@ -1721,9 +1708,6 @@ static ssize_t incfs_setxattr(struct user_namespace *ns, struct dentry *d,
|
||||
size_t *stored_size;
|
||||
int i;
|
||||
|
||||
if (!mi)
|
||||
return -EBADF;
|
||||
|
||||
if (di && di->backing_path.dentry)
|
||||
return vfs_setxattr(ns, di->backing_path.dentry, name, value,
|
||||
size, flags);
|
||||
@@ -1762,11 +1746,6 @@ static ssize_t incfs_listxattr(struct dentry *d, char *list, size_t size)
|
||||
return vfs_listxattr(di->backing_path.dentry, list, size);
|
||||
}
|
||||
|
||||
static int incfs_test_super(struct super_block *s, void *p)
|
||||
{
|
||||
return s->s_fs_info != NULL;
|
||||
}
|
||||
|
||||
struct dentry *incfs_mount_fs(struct file_system_type *type, int flags,
|
||||
const char *dev_name, void *data)
|
||||
{
|
||||
@@ -1777,8 +1756,7 @@ struct dentry *incfs_mount_fs(struct file_system_type *type, int flags,
|
||||
struct dentry *incomplete_dir = NULL;
|
||||
struct super_block *src_fs_sb = NULL;
|
||||
struct inode *root_inode = NULL;
|
||||
struct super_block *sb = sget(type, incfs_test_super, set_anon_super,
|
||||
flags, NULL);
|
||||
struct super_block *sb = sget(type, NULL, set_anon_super, flags, NULL);
|
||||
int error = 0;
|
||||
|
||||
if (IS_ERR(sb))
|
||||
@@ -1819,18 +1797,13 @@ struct dentry *incfs_mount_fs(struct file_system_type *type, int flags,
|
||||
src_fs_sb = backing_dir_path.dentry->d_sb;
|
||||
sb->s_maxbytes = src_fs_sb->s_maxbytes;
|
||||
|
||||
if (!sb->s_fs_info) {
|
||||
mi = incfs_alloc_mount_info(sb, &options, &backing_dir_path);
|
||||
mi = incfs_alloc_mount_info(sb, &options, &backing_dir_path);
|
||||
|
||||
if (IS_ERR_OR_NULL(mi)) {
|
||||
error = PTR_ERR(mi);
|
||||
pr_err("incfs: Error allocating mount info. %d\n", error);
|
||||
mi = NULL;
|
||||
goto err;
|
||||
}
|
||||
sb->s_fs_info = mi;
|
||||
} else {
|
||||
mi = sb->s_fs_info;
|
||||
if (IS_ERR_OR_NULL(mi)) {
|
||||
error = PTR_ERR(mi);
|
||||
pr_err("incfs: Error allocating mount info. %d\n", error);
|
||||
mi = NULL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
index_dir = open_or_create_special_dir(backing_dir_path.dentry,
|
||||
@@ -1855,28 +1828,26 @@ struct dentry *incfs_mount_fs(struct file_system_type *type, int flags,
|
||||
}
|
||||
mi->mi_incomplete_dir = incomplete_dir;
|
||||
|
||||
sb->s_fs_info = mi;
|
||||
root_inode = fetch_regular_inode(sb, backing_dir_path.dentry);
|
||||
if (IS_ERR(root_inode)) {
|
||||
error = PTR_ERR(root_inode);
|
||||
goto err;
|
||||
}
|
||||
|
||||
sb->s_root = d_make_root(root_inode);
|
||||
if (!sb->s_root) {
|
||||
sb->s_root = d_make_root(root_inode);
|
||||
if (!sb->s_root) {
|
||||
error = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
error = incfs_init_dentry(sb->s_root, &backing_dir_path);
|
||||
if (error)
|
||||
goto err;
|
||||
error = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
error = incfs_init_dentry(sb->s_root, &backing_dir_path);
|
||||
if (error)
|
||||
goto err;
|
||||
|
||||
mi->mi_backing_dir_path = backing_dir_path;
|
||||
path_put(&backing_dir_path);
|
||||
sb->s_flags |= SB_ACTIVE;
|
||||
|
||||
pr_debug("incfs: mount\n");
|
||||
free_options(&options);
|
||||
return dget(sb->s_root);
|
||||
err:
|
||||
sb->s_fs_info = NULL;
|
||||
@@ -1893,9 +1864,6 @@ static int incfs_remount_fs(struct super_block *sb, int *flags, char *data)
|
||||
struct mount_info *mi = get_mount_info(sb);
|
||||
int err = 0;
|
||||
|
||||
if (!mi)
|
||||
return err;
|
||||
|
||||
sync_filesystem(sb);
|
||||
err = parse_options(&options, (char *)data);
|
||||
if (err)
|
||||
@@ -1923,23 +1891,14 @@ void incfs_kill_sb(struct super_block *sb)
|
||||
struct mount_info *mi = sb->s_fs_info;
|
||||
|
||||
pr_debug("incfs: unmount\n");
|
||||
vfs_rmdir(&init_user_ns, d_inode(mi->mi_backing_dir_path.dentry),
|
||||
mi->mi_index_dir);
|
||||
vfs_rmdir(&init_user_ns, d_inode(mi->mi_backing_dir_path.dentry),
|
||||
mi->mi_incomplete_dir);
|
||||
|
||||
kill_anon_super(sb);
|
||||
generic_shutdown_super(sb);
|
||||
incfs_free_mount_info(mi);
|
||||
sb->s_fs_info = NULL;
|
||||
}
|
||||
|
||||
static int show_options(struct seq_file *m, struct dentry *root)
|
||||
{
|
||||
struct mount_info *mi = get_mount_info(root->d_sb);
|
||||
|
||||
if (!mi)
|
||||
return -EBADF;
|
||||
|
||||
seq_printf(m, ",read_timeout_ms=%u", mi->mi_options.read_timeout_ms);
|
||||
seq_printf(m, ",readahead=%u", mi->mi_options.readahead_pages);
|
||||
if (mi->mi_options.read_log_pages != 0) {
|
||||
|
||||
@@ -19,6 +19,7 @@ static inline struct mount_info *get_mount_info(struct super_block *sb)
|
||||
{
|
||||
struct mount_info *result = sb->s_fs_info;
|
||||
|
||||
WARN_ON(!result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user