ANDROID: Incremental fs: Fix four resource bugs

Without these, you can't unmount a volume on which incfs was
mounted and the tests run.

Also incfs_tests would fail sporadically without the fix to
test_inode

Test: Run incfs_test and unmount underlying volume 1000 times
Bug: 152636070
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I88f11f5d4269c22d9073e5eb671d0c7cc4629f6c
(cherry picked from commit c062bc8e769f0f6e47cc41fb9b7ab30e3e7f2689)
This commit is contained in:
Paul Lawrence 2020-03-26 12:53:11 -07:00
parent a2156f0878
commit 8794e1ed09

View file

@ -346,8 +346,8 @@ static int inode_test(struct inode *inode, void *opaque)
return (node->n_backing_inode == backing_inode) &&
inode->i_ino == search->ino;
}
return 1;
} else
return inode->i_ino == search->ino;
}
static int inode_set(struct inode *inode, void *opaque)
@ -893,6 +893,7 @@ static int init_new_file(struct mount_info *mi, struct dentry *dentry,
}
bfc = incfs_alloc_bfc(new_file);
fput(new_file);
if (IS_ERR(bfc)) {
error = PTR_ERR(bfc);
bfc = NULL;
@ -1675,6 +1676,7 @@ static int final_file_delete(struct mount_info *mi,
if (d_really_is_positive(index_file_dentry))
error = incfs_unlink(index_file_dentry);
out:
dput(index_file_dentry);
if (error)
pr_debug("incfs: delete_file_from_index err:%d\n", error);
return error;
@ -1977,6 +1979,7 @@ static void dentry_release(struct dentry *d)
if (di)
path_put(&di->backing_path);
kfree(d->d_fsdata);
d->d_fsdata = NULL;
}
@ -2188,7 +2191,7 @@ struct dentry *incfs_mount_fs(struct file_system_type *type, int flags,
path_put(&backing_dir_path);
sb->s_flags |= SB_ACTIVE;
pr_debug("infs: mount\n");
pr_debug("incfs: mount\n");
return dget(sb->s_root);
err:
sb->s_fs_info = NULL;
@ -2214,7 +2217,7 @@ static int incfs_remount_fs(struct super_block *sb, int *flags, char *data)
pr_debug("incfs: new timeout_ms=%d", options.read_timeout_ms);
}
pr_debug("infs: remount\n");
pr_debug("incfs: remount\n");
return 0;
}
@ -2222,7 +2225,7 @@ void incfs_kill_sb(struct super_block *sb)
{
struct mount_info *mi = sb->s_fs_info;
pr_debug("infs: unmount\n");
pr_debug("incfs: unmount\n");
incfs_free_mount_info(mi);
generic_shutdown_super(sb);
}