Whamcloud - gitweb
- highmem-split-2.6.10-fc3.patch in order to make 3GB memory on mountain's
[fs/lustre-release.git] / lustre / kernel_patches / patches / vfs-lookup_last-vanilla-2.6.10-fc3.patch
1 Index: linux-2.6.10/fs/namei.c
2 ===================================================================
3 --- linux-2.6.10.orig/fs/namei.c        2005-03-31 17:12:26.403006808 +0800
4 +++ linux-2.6.10/fs/namei.c     2005-03-31 17:20:37.388365688 +0800
5 @@ -783,8 +783,11 @@
6                         goto out_dput;
7  
8                 if (inode->i_op->follow_link) {
9 +                       int saved_flags = nd->flags;
10                         mntget(next.mnt);
11 +                       nd->flags |= LOOKUP_LINK_NOTLAST;
12                         err = do_follow_link(next.dentry, nd);
13 +                       nd->flags = saved_flags;
14                         dput(next.dentry);
15                         mntput(next.mnt);
16                         if (err)
17 @@ -830,7 +833,9 @@
18                         if (err < 0)
19                                 break;
20                 }
21 +               nd->flags |= LOOKUP_LAST;
22                 err = do_lookup(nd, &this, &next, atomic);
23 +               nd->flags &= ~LOOKUP_LAST;
24                 if (err)
25                         break;
26                 follow_mount(&next.mnt, &next.dentry);
27 @@ -876,10 +881,14 @@
28                  */
29                 if (nd->dentry && nd->dentry->d_sb &&
30                     (nd->dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)) {
31 -                       err = -ESTALE;
32 +                       nd->flags |= LOOKUP_LAST;
33 +                       err = !nd->dentry->d_op->d_revalidate(nd->dentry, nd);
34 +                        nd->flags &= ~LOOKUP_LAST;
35                         /* Note: we do not d_invalidate() */
36 -                       if (!nd->dentry->d_op->d_revalidate(nd->dentry, nd))
37 +                       if (err) {
38 +                               err = -ESTALE;
39                                 break;
40 +                       }
41                 }
42  return_base:
43                 return 0;
44 @@ -1446,7 +1455,9 @@
45         dir = nd->dentry;
46         nd->flags &= ~LOOKUP_PARENT;
47         down(&dir->d_inode->i_sem);
48 +       nd->flags |= LOOKUP_LAST;
49         dentry = __lookup_hash(&nd->last, nd->dentry, nd);
50 +       nd->flags &= ~LOOKUP_LAST;
51  
52  do_last:
53         error = PTR_ERR(dentry);
54 @@ -1559,7 +1570,9 @@
55         }
56         dir = nd->dentry;
57         down(&dir->d_inode->i_sem);
58 +       nd->flags |= LOOKUP_LAST;
59         dentry = __lookup_hash(&nd->last, nd->dentry, nd);
60 +       nd->flags &= ~LOOKUP_LAST;
61         putname(nd->last.name);
62         goto do_last;
63  }
64 Index: linux-2.6.10/include/linux/namei.h
65 ===================================================================
66 --- linux-2.6.10.orig/include/linux/namei.h     2005-03-31 17:10:14.746021712 +0800
67 +++ linux-2.6.10/include/linux/namei.h  2005-03-31 17:21:41.178668088 +0800
68 @@ -73,7 +73,9 @@
69  #define LOOKUP_PARENT          16
70  #define LOOKUP_NOALT           32
71  #define LOOKUP_ATOMIC          64
72 -
73 +#define LOOKUP_LAST            128     
74 +#define LOOKUP_LINK_NOTLAST    256     
75 ++ 
76  /*
77   * Intent data
78   */