Whamcloud - gitweb
Branch: HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / vfs-raw_ops-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:43:42.417809208 +0800
4 +++ linux-2.6.10/fs/namei.c     2005-03-31 17:47:14.292599344 +0800
5 @@ -474,6 +474,7 @@
6         intent_init(&nd->intent.open, it.op);
7         nd->intent.open.flags = it.flags;
8         nd->intent.open.create_mode = it.create_mode;
9 +       nd->intent.open.create = it.create;
10         res = link_path_walk(link, nd);
11  out:
12         if (nd->depth || res || nd->last_type!=LAST_NORM)
13 @@ -866,14 +867,20 @@
14  lookup_parent:
15                 nd->last = this;
16                 nd->last_type = LAST_NORM;
17 -               if (this.name[0] != '.')
18 -                       goto return_base;
19 -               if (this.len == 1)
20 -                       nd->last_type = LAST_DOT;
21 -               else if (this.len == 2 && this.name[1] == '.')
22 -                       nd->last_type = LAST_DOTDOT;
23 -               else
24 -                       goto return_base;
25 +               if (this.name[0] == '.') {
26 +                       if (this.len == 1)
27 +                               nd->last_type = LAST_DOT;
28 +                       else if (this.len == 2 && this.name[1] == '.')
29 +                               nd->last_type = LAST_DOTDOT;
30 +               }
31 +
32 +               if ((nd->last_type == LAST_NORM) && inode->i_op &&
33 +                   inode->i_op->endparentlookup) {
34 +                       err = inode->i_op->endparentlookup(nd);
35 +                       if (err)
36 +                               break;
37 +               }
38 +               goto return_base;
39  return_reval:
40                 /*
41                  * We bypassed the ordinary revalidation routines.
42 @@ -1646,9 +1653,16 @@
43         if (IS_ERR(tmp))
44                 return PTR_ERR(tmp);
45  
46 -       error = path_lookup(tmp, LOOKUP_PARENT, &nd);
47 +       intent_init(&nd.intent.open, IT_MKNOD);
48 +       nd.intent.open.create_mode = mode;
49 +       nd.intent.open.create.dev = dev;
50 +
51 +       error = path_lookup_it(tmp, LOOKUP_PARENT, &nd);
52         if (error)
53                 goto out;
54 +       if (nd.intent.open.flags & IT_STATUS_RAW)
55 +               goto out2;
56 +
57         dentry = lookup_create(&nd, 0);
58         error = PTR_ERR(dentry);
59  
60 @@ -1675,6 +1689,7 @@
61                 dput(dentry);
62         }
63         up(&nd.dentry->d_inode->i_sem);
64 +out2:
65         path_release(&nd);
66  out:
67         putname(tmp);
68 @@ -1717,9 +1732,13 @@
69                 struct dentry *dentry;
70                 struct nameidata nd;
71  
72 -               error = path_lookup(tmp, LOOKUP_PARENT, &nd);
73 +               intent_init(&nd.intent.open, IT_MKDIR);
74 +               nd.intent.open.create_mode = mode;
75 +               error = path_lookup_it(tmp, LOOKUP_PARENT, &nd);
76                 if (error)
77                         goto out;
78 +               if (nd.intent.open.flags & IT_STATUS_RAW)
79 +                       goto out2;
80                 dentry = lookup_create(&nd, 1);
81                 error = PTR_ERR(dentry);
82                 if (!IS_ERR(dentry)) {
83 @@ -1729,6 +1748,7 @@
84                         dput(dentry);
85                 }
86                 up(&nd.dentry->d_inode->i_sem);
87 +out2:
88                 path_release(&nd);
89  out:
90                 putname(tmp);
91 @@ -1814,9 +1834,12 @@
92         if(IS_ERR(name))
93                 return PTR_ERR(name);
94  
95 -       error = path_lookup(name, LOOKUP_PARENT, &nd);
96 +       intent_init(&nd.intent.open, IT_RMDIR);
97 +       error = path_lookup_it(name, LOOKUP_PARENT, &nd);
98         if (error)
99                 goto exit;
100 +       if (nd.intent.open.flags & IT_STATUS_RAW)
101 +               goto exit1;
102  
103         switch(nd.last_type) {
104                 case LAST_DOTDOT:
105 @@ -1892,9 +1915,13 @@
106         if(IS_ERR(name))
107                 return PTR_ERR(name);
108  
109 -       error = path_lookup(name, LOOKUP_PARENT, &nd);
110 +       intent_init(&nd.intent.open, IT_UNLINK);
111 +       error = path_lookup_it(name, LOOKUP_PARENT, &nd);
112         if (error)
113                 goto exit;
114 +       if (nd.intent.open.flags & IT_STATUS_RAW)
115 +               goto exit1;
116 +
117         error = -EISDIR;
118         if (nd.last_type != LAST_NORM)
119                 goto exit1;
120 @@ -1965,9 +1992,13 @@
121                 struct dentry *dentry;
122                 struct nameidata nd;
123  
124 -               error = path_lookup(to, LOOKUP_PARENT, &nd);
125 +               intent_init(&nd.intent.open, IT_SYMLINK);
126 +               nd.intent.open.create.link = from;
127 +               error = path_lookup_it(to, LOOKUP_PARENT, &nd);
128                 if (error)
129                         goto out;
130 +               if (nd.intent.open.flags & IT_STATUS_RAW)
131 +                       goto out2;
132                 dentry = lookup_create(&nd, 0);
133                 error = PTR_ERR(dentry);
134                 if (!IS_ERR(dentry)) {
135 @@ -1975,6 +2006,7 @@
136                         dput(dentry);
137                 }
138                 up(&nd.dentry->d_inode->i_sem);
139 +out2:
140                 path_release(&nd);
141  out:
142                 putname(to);
143 @@ -2046,9 +2078,13 @@
144         error = __user_walk(oldname, 0, &old_nd);
145         if (error)
146                 goto exit;
147 -       error = path_lookup(to, LOOKUP_PARENT, &nd);
148 +       intent_init(&nd.intent.open, IT_LINK);
149 +       nd.intent.open.create.source_nd = &old_nd;
150 +       error = path_lookup_it(to, LOOKUP_PARENT, &nd);
151         if (error)
152                 goto out;
153 +       if (nd.intent.open.flags & IT_STATUS_RAW)
154 +               goto out_release;
155         error = -EXDEV;
156         if (old_nd.mnt != nd.mnt)
157                 goto out_release;
158 @@ -2229,9 +2265,18 @@
159         if (error)
160                 goto exit;
161  
162 -       error = path_lookup(newname, LOOKUP_PARENT, &newnd);
163 +       error = -EBUSY;
164 +       if (oldnd.last_type != LAST_NORM)
165 +               goto exit1;
166 +
167 +       intent_init(&newnd.intent.open, IT_RENAME);
168 +       newnd.intent.open.create.source_nd = &oldnd;
169 +       error = path_lookup_it(newname, LOOKUP_PARENT, &newnd);
170         if (error)
171                 goto exit1;
172 +       if (newnd.intent.open.flags & IT_STATUS_RAW) {
173 +               goto exit2;
174 +       }
175  
176         error = -EXDEV;
177         if (oldnd.mnt != newnd.mnt)
178 @@ -2239,8 +2284,6 @@
179  
180         old_dir = oldnd.dentry;
181         error = -EBUSY;
182 -       if (oldnd.last_type != LAST_NORM)
183 -               goto exit2;
184  
185         new_dir = newnd.dentry;
186         if (newnd.last_type != LAST_NORM)
187 Index: linux-2.6.10/include/linux/fs.h
188 ===================================================================
189 --- linux-2.6.10.orig/include/linux/fs.h        2005-03-31 17:03:37.000000000 +0800
190 +++ linux-2.6.10/include/linux/fs.h     2005-03-31 17:46:35.715463960 +0800
191 @@ -956,6 +956,7 @@
192         ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
193         ssize_t (*listxattr) (struct dentry *, char *, size_t);
194         int (*removexattr) (struct dentry *, const char *);
195 +       int (*endparentlookup) (struct nameidata *);
196  };
197  
198  struct seq_file;
199 Index: linux-2.6.10/include/linux/namei.h
200 ===================================================================
201 --- linux-2.6.10.orig/include/linux/namei.h     2005-03-31 17:43:42.472800848 +0800
202 +++ linux-2.6.10/include/linux/namei.h  2005-03-31 17:50:12.533502608 +0800
203 @@ -15,8 +15,19 @@
204  #define IT_UNLINK      (1<<5)
205  #define IT_TRUNC       (1<<6)
206  #define IT_GETXATTR    (1<<7)
207
208 +#define IT_RMDIR       (1<<8)
209 +#define IT_LINK                (1<<9)
210 +#define IT_RENAME      (1<<10)
211 +#define IT_MKDIR       (1<<11)
212 +#define IT_MKNOD       (1<<12)
213 +#define IT_SYMLINK     (1<<13)
214 +#define IT_CHDIR       (1<<14)
215 +
216  #define INTENT_MAGIC 0x19620323
217 +#define IT_STATUS_RAW (1<<10)  /* Setting this in it_flags on exit from lookup
218 +                                   means everything was done already and return
219 +                                   value from lookup is in fact status of
220 +                                   already performed operation */
221   
222  
223  struct open_intent {
224 @@ -26,6 +37,11 @@
225         int     flags;
226         int     create_mode;
227         union {
228 +               unsigned        dev;    /* For mknod */
229 +               char    *link;  /* For symlink */
230 +               struct nameidata *source_nd; /* For link/rename */
231 +       } create;
232 +       union {
233                 void *fs_data; /* FS-specific intent data */
234         } d;
235  };