diff options
author | Tiger Yang <tiger.yang@oracle.com> | 2006-08-31 23:39:47 -0400 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-09-20 18:52:27 -0400 |
commit | 0f62de2c9ca60a35f63122e7ea992cee8aae4bef (patch) | |
tree | 31af0006aedea3a22e463198b5c4a00ca893bf1c | |
parent | a663e30513d7ecc77dd71d474e7646bf78c0ba62 (diff) |
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: Tiger Yang <tiger.yang@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
-rw-r--r-- | fs/ocfs2/namei.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index d8161a77c370..24126476a8cc 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -641,11 +641,6 @@ static int ocfs2_link(struct dentry *old_dentry, | |||
641 | goto bail; | 641 | goto bail; |
642 | } | 642 | } |
643 | 643 | ||
644 | if (inode->i_nlink >= OCFS2_LINK_MAX) { | ||
645 | err = -EMLINK; | ||
646 | goto bail; | ||
647 | } | ||
648 | |||
649 | handle = ocfs2_alloc_handle(osb); | 644 | handle = ocfs2_alloc_handle(osb); |
650 | if (handle == NULL) { | 645 | if (handle == NULL) { |
651 | err = -ENOMEM; | 646 | err = -ENOMEM; |
@@ -659,6 +654,11 @@ static int ocfs2_link(struct dentry *old_dentry, | |||
659 | goto bail; | 654 | goto bail; |
660 | } | 655 | } |
661 | 656 | ||
657 | if (!dir->i_nlink) { | ||
658 | err = -ENOENT; | ||
659 | goto bail; | ||
660 | } | ||
661 | |||
662 | err = ocfs2_check_dir_for_entry(dir, dentry->d_name.name, | 662 | err = ocfs2_check_dir_for_entry(dir, dentry->d_name.name, |
663 | dentry->d_name.len); | 663 | dentry->d_name.len); |
664 | if (err) | 664 | if (err) |