summaryrefslogtreecommitdiff
path: root/fs/f2fs/namei.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2018-09-17 13:25:04 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2018-09-26 12:38:11 -0700
commitd83d0f5ba8532e649146ac32ae47167a28d98c84 (patch)
tree66228821adf71b01a514eac67df4081972822d16 /fs/f2fs/namei.c
parentc6b1867b1da3b1203b4c49988afeebdcbdf65499 (diff)
f2fs: report ENOENT correctly in f2fs_rename
This fixes wrong error report in f2fs_rename. Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/namei.c')
-rw-r--r--fs/f2fs/namei.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 9ad451ac2cec..ded185baa9ae 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -820,7 +820,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct f2fs_dir_entry *old_entry;
struct f2fs_dir_entry *new_entry;
bool is_old_inline = f2fs_has_inline_dentry(old_dir);
- int err = -ENOENT;
+ int err;
if (unlikely(f2fs_cp_error(sbi)))
return -EIO;
@@ -844,6 +844,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
goto out;
}
+ err = -ENOENT;
old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page);
if (!old_entry) {
if (IS_ERR(old_page))
@@ -1009,7 +1010,7 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
struct f2fs_dir_entry *old_dir_entry = NULL, *new_dir_entry = NULL;
struct f2fs_dir_entry *old_entry, *new_entry;
int old_nlink = 0, new_nlink = 0;
- int err = -ENOENT;
+ int err;
if (unlikely(f2fs_cp_error(sbi)))
return -EIO;
@@ -1030,6 +1031,7 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
if (err)
goto out;
+ err = -ENOENT;
old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page);
if (!old_entry) {
if (IS_ERR(old_page))