summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/namei.c
diff options
context:
space:
mode:
authorKinglong Mee2017-03-04 14:48:28 +0100
committerJaegeuk Kim2017-03-21 21:52:16 +0100
commite2f0e962ac2190ab4e0d1ee4b258273d3a51e689 (patch)
tree43225c527a802eda326ea240081b9a59b709e779 /fs/f2fs/namei.c
parentf2fs: don't allow to get pino when filename is encrypted (diff)
downloadkernel-qcow2-linux-e2f0e962ac2190ab4e0d1ee4b258273d3a51e689.tar.gz
kernel-qcow2-linux-e2f0e962ac2190ab4e0d1ee4b258273d3a51e689.tar.xz
kernel-qcow2-linux-e2f0e962ac2190ab4e0d1ee4b258273d3a51e689.zip
f2fs: fix the fault of checking F2FS_LINK_MAX for rename inode
The parent directory's nlink will change, not the inode. Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> 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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 98f00a3a7f50..25c073f6c7d4 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -908,8 +908,8 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
old_nlink = old_dir_entry ? -1 : 1;
new_nlink = -old_nlink;
err = -EMLINK;
- if ((old_nlink > 0 && old_inode->i_nlink >= F2FS_LINK_MAX) ||
- (new_nlink > 0 && new_inode->i_nlink >= F2FS_LINK_MAX))
+ if ((old_nlink > 0 && old_dir->i_nlink >= F2FS_LINK_MAX) ||
+ (new_nlink > 0 && new_dir->i_nlink >= F2FS_LINK_MAX))
goto out_new_dir;
}