Skip to content

Commit

Permalink
ocfs2: Fix directory link count checks in ocfs2_link()
Browse files Browse the repository at this point in the history
Remove the redundant "i_nlink >= OCFS2_LINK_MAX" check and adds an unlinked
directory check in ocfs2_link().

Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
  • Loading branch information
Tiger Yang authored and Mark Fasheh committed Sep 20, 2006
1 parent a663e30 commit 0f62de2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fs/ocfs2/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit 0f62de2

Please sign in to comment.