Commit 3e19886e authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: report error for f2fs_parent_dir

If there is no dentry, we can report its error correctly.
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 8be0fea9
......@@ -662,11 +662,12 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
goto out;
if (S_ISDIR(old_inode->i_mode)) {
err = -EIO;
old_dir_entry = f2fs_parent_dir(old_inode, &old_dir_page);
if (!old_dir_entry)
if (!old_dir_entry) {
err = PTR_ERR(old_dir_page);
goto out_old;
}
}
if (flags & RENAME_WHITEOUT) {
err = f2fs_create_whiteout(old_dir, &whiteout);
......@@ -838,21 +839,23 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
/* prepare for updating ".." directory entry info later */
if (old_dir != new_dir) {
if (S_ISDIR(old_inode->i_mode)) {
err = -EIO;
old_dir_entry = f2fs_parent_dir(old_inode,
&old_dir_page);
if (!old_dir_entry)
if (!old_dir_entry) {
err = PTR_ERR(old_dir_page);
goto out_new;
}
}
if (S_ISDIR(new_inode->i_mode)) {
err = -EIO;
new_dir_entry = f2fs_parent_dir(new_inode,
&new_dir_page);
if (!new_dir_entry)
if (!new_dir_entry) {
err = PTR_ERR(new_dir_page);
goto out_old_dir;
}
}
}
/*
* If cross rename between file and directory those are not
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment