Whamcloud - gitweb
LU-5022 ldiskfs: enable support for RHEL7
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel7 / ext4-lookup-dotdot.patch
1 Index: linux-3.10.9-200.fc17.x86_64/fs/ext4/namei.c
2 ===================================================================
3 --- linux-3.10.9-200.fc17.x86_64.orig/fs/ext4/namei.c
4 +++ linux-3.10.9-200.fc17.x86_64/fs/ext4/namei.c
5 @@ -1438,6 +1438,32 @@ static struct dentry *ext4_lookup(struct
6                         return ERR_PTR(-EIO);
7                 }
8         }
9 +       /* ".." shouldn't go into dcache to preserve dcache hierarchy
10 +        * otherwise we'll get parent being a child of actual child.
11 +        * see bug 10458 for details -bzzz */
12 +       if (inode && (dentry->d_name.name[0] == '.' && (dentry->d_name.len == 1 ||
13 +               (dentry->d_name.len == 2 && dentry->d_name.name[1] == '.')))) {
14 +               struct dentry *goal = NULL;
15 +
16 +               /* first, look for an existing dentry - any one is good */
17 +               goal = d_find_any_alias(inode);
18 +               if (goal == NULL) {
19 +                       spin_lock(&dentry->d_lock);
20 +                       /* there is no alias, we need to make current dentry:
21 +                        *  a) inaccessible for __d_lookup()
22 +                        *  b) inaccessible for iopen */
23 +                       J_ASSERT(hlist_unhashed(&dentry->d_alias));
24 +                       dentry->d_flags |= DCACHE_NFSFS_RENAMED;
25 +                       /* this is d_instantiate() ... */
26 +                       hlist_add_head(&dentry->d_alias, &inode->i_dentry);
27 +                       dentry->d_inode = inode;
28 +                       spin_unlock(&dentry->d_lock);
29 +               }
30 +               if (goal)
31 +                       iput(inode);
32 +               return goal;
33 +       }
34 +
35         return d_splice_alias(inode, dentry);
36  }
37