From ccb94354035b9107e3cc4bf0bd3d101f51d8ebcd Mon Sep 17 00:00:00 2001 From: Paul Lawrence Date: Tue, 26 Jan 2021 13:31:12 -0800 Subject: [PATCH] Revert "ANDROID: Incremental fs: Don't allow renaming .index directory." This reverts commit 85e158e3e144849c453f768d26de7696d64253d1. Set incfs back to rvc shipping incfs Bug: 178509184 Test: incfs_test passes Signed-off-by: Paul Lawrence Change-Id: Id119ffb4da700bd28baad5c303a6369311b2b3f5 --- fs/incfs/vfs.c | 14 ++------------ .../selftests/filesystems/incfs/incfs_test.c | 12 ------------ 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/fs/incfs/vfs.c b/fs/incfs/vfs.c index 10b6727c8fd9..69a01f346446 100644 --- a/fs/incfs/vfs.c +++ b/fs/incfs/vfs.c @@ -780,8 +780,7 @@ static struct dentry *open_or_create_index_dir(struct dentry *backing_dir) if (err) return ERR_PTR(err); - if (!d_really_is_positive(index_dentry) || - unlikely(d_unhashed(index_dentry))) { + if (!d_really_is_positive(index_dentry)) { dput(index_dentry); return ERR_PTR(-EINVAL); } @@ -1647,8 +1646,7 @@ static int dir_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) if (!err) { struct inode *inode = NULL; - if (d_really_is_negative(backing_dentry) || - unlikely(d_unhashed(backing_dentry))) { + if (d_really_is_negative(backing_dentry)) { err = -EINVAL; goto out; } @@ -1873,13 +1871,6 @@ static int dir_rename(struct inode *old_dir, struct dentry *old_dentry, return error; backing_old_dentry = get_incfs_dentry(old_dentry)->backing_path.dentry; - - if (!backing_old_dentry || backing_old_dentry == mi->mi_index_dir) { - /* Renaming .index not allowed */ - error = -EBUSY; - goto exit; - } - backing_new_dentry = get_incfs_dentry(new_dentry)->backing_path.dentry; dget(backing_old_dentry); dget(backing_new_dentry); @@ -1926,7 +1917,6 @@ static int dir_rename(struct inode *old_dir, struct dentry *old_dentry, dput(backing_new_dentry); dput(backing_old_dentry); -exit: mutex_unlock(&mi->mi_dir_struct_mutex); if (error) pr_debug("incfs: %s err:%d\n", __func__, error); diff --git a/tools/testing/selftests/filesystems/incfs/incfs_test.c b/tools/testing/selftests/filesystems/incfs/incfs_test.c index a3ab9f2a7e67..fdf29f5ca9cd 100644 --- a/tools/testing/selftests/filesystems/incfs/incfs_test.c +++ b/tools/testing/selftests/filesystems/incfs/incfs_test.c @@ -837,12 +837,6 @@ static int cant_touch_index_test(const char *mount_dir) goto failure; } - err = rmdir(index_path); - if (err == 0 || errno != EBUSY) { - print_error(".index directory should not be removed\n"); - goto failure; - } - err = emit_file(cmd_fd, ".index", file_name, &file_id, file_size, NULL); if (err != -EBUSY) { @@ -877,12 +871,6 @@ static int cant_touch_index_test(const char *mount_dir) goto failure; } - err = rename(index_path, dst_name); - if (err == 0 || errno != EBUSY) { - print_error("Shouldn't rename .index directory\n"); - goto failure; - } - close(cmd_fd); free(subdir); free(index_path);