]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
ocfs2: Fix directory link count checks in ocfs2_link()
authorTiger Yang <tiger.yang@oracle.com>
Fri, 1 Sep 2006 03:39:47 +0000 (20:39 -0700)
committerMark Fasheh <mark.fasheh@oracle.com>
Wed, 20 Sep 2006 22:52:27 +0000 (15:52 -0700)
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>
fs/ocfs2/namei.c

index d8161a77c370ea39b4488d4e81ac2acd39000ab1..24126476a8ccd95e1cc505d5bb72d46990ae90e5 100644 (file)
@@ -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)