aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ocfs2/namei.c10
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)