提交 0f62de2c 编写于 作者: T Tiger Yang 提交者: Mark Fasheh

ocfs2: Fix directory link count checks in ocfs2_link()

Remove the redundant "i_nlink >= OCFS2_LINK_MAX" check and adds an unlinked
directory check in ocfs2_link().
Signed-off-by: NTiger Yang <tiger.yang@oracle.com>
Signed-off-by: NMark Fasheh <mark.fasheh@oracle.com>
上级 a663e305
......@@ -641,11 +641,6 @@ static int ocfs2_link(struct dentry *old_dentry,
goto bail;
}
if (inode->i_nlink >= OCFS2_LINK_MAX) {
err = -EMLINK;
goto bail;
}
handle = ocfs2_alloc_handle(osb);
if (handle == NULL) {
err = -ENOMEM;
......@@ -659,6 +654,11 @@ static int ocfs2_link(struct dentry *old_dentry,
goto bail;
}
if (!dir->i_nlink) {
err = -ENOENT;
goto bail;
}
err = ocfs2_check_dir_for_entry(dir, dentry->d_name.name,
dentry->d_name.len);
if (err)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册