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)
tirimbino
Paul Lawrence 5 years ago
parent bf3b3bbdfc
commit a4cad4eb80
  1. 13
      fs/incfs/vfs.c

@ -349,8 +349,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)
@ -896,6 +896,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;
@ -1678,6 +1679,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;
@ -1980,6 +1982,7 @@ static void dentry_release(struct dentry *d)
if (di)
path_put(&di->backing_path);
kfree(d->d_fsdata);
d->d_fsdata = NULL;
}
@ -2191,7 +2194,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;
@ -2217,7 +2220,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;
}
@ -2225,7 +2228,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);
}

Loading…
Cancel
Save