Whamcloud - gitweb
merge b_devel into HEAD, which will become 0.7.3
[fs/lustre-release.git] / lustre / kernel_patches / patches / vfs_intent-2.4.18-18-chaos65.patch
1  fs/dcache.c            |   19 ++
2  fs/exec.c              |   15 +-
3  fs/namei.c             |  355 +++++++++++++++++++++++++++++++++++++++++--------
4  fs/namespace.c         |   30 +++-
5  fs/open.c              |  122 ++++++++++++++--
6  fs/proc/base.c         |    3 
7  fs/stat.c              |   27 ++-
8  include/linux/dcache.h |   54 +++++++
9  include/linux/fs.h     |   31 ++++
10  kernel/exit.c          |    3 
11  kernel/fork.c          |    3 
12  kernel/ksyms.c         |    1 
13  12 files changed, 564 insertions(+), 99 deletions(-)
14
15 --- linux-2.4.18-p4smp/fs/exec.c~vfs_intent-2.4.18-18-chaos65   2003-07-09 12:17:30.000000000 -0600
16 +++ linux-2.4.18-p4smp-braam/fs/exec.c  2003-07-09 13:20:37.000000000 -0600
17 @@ -117,8 +117,9 @@ asmlinkage long sys_uselib(const char * 
18         struct file * file;
19         struct nameidata nd;
20         int error;
21 +       struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = O_RDONLY };
22  
23 -       error = user_path_walk(library, &nd);
24 +       error = user_path_walk_it(library, &nd, &it);
25         if (error)
26                 goto out;
27  
28 @@ -130,7 +131,8 @@ asmlinkage long sys_uselib(const char * 
29         if (error)
30                 goto exit;
31  
32 -       file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
33 +       file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it);
34 +       intent_release(&it);
35         error = PTR_ERR(file);
36         if (IS_ERR(file))
37                 goto out;
38 @@ -359,8 +361,9 @@ struct file *open_exec(const char *name)
39         struct inode *inode;
40         struct file *file;
41         int err = 0;
42 +       struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = O_RDONLY };
43  
44 -       err = path_lookup(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd);
45 +       err = path_lookup_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd, &it);
46         file = ERR_PTR(err);
47         if (!err) {
48                 inode = nd.dentry->d_inode;
49 @@ -372,7 +375,8 @@ struct file *open_exec(const char *name)
50                                 err = -EACCES;
51                         file = ERR_PTR(err);
52                         if (!err) {
53 -                               file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
54 +                               file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it);
55 +                               intent_release(&it);
56                                 if (!IS_ERR(file)) {
57                                         err = deny_write_access(file);
58                                         if (err) {
59 @@ -384,6 +388,7 @@ out:
60                                 return file;
61                         }
62                 }
63 +               intent_release(&it);
64                 path_release(&nd);
65         }
66         goto out;
67 @@ -1104,7 +1109,7 @@ int do_coredump(long signr, struct pt_re
68                 goto close_fail;
69         if (!file->f_op->write)
70                 goto close_fail;
71 -       if (do_truncate(file->f_dentry, 0) != 0)
72 +       if (do_truncate(file->f_dentry, 0, 0) != 0)
73                 goto close_fail;
74  
75         retval = binfmt->core_dump(signr, regs, file);
76 --- linux-2.4.18-p4smp/fs/dcache.c~vfs_intent-2.4.18-18-chaos65 2003-07-09 12:17:30.000000000 -0600
77 +++ linux-2.4.18-p4smp-braam/fs/dcache.c        2003-07-09 13:20:37.000000000 -0600
78 @@ -186,6 +186,13 @@ int d_invalidate(struct dentry * dentry)
79                 spin_unlock(&dcache_lock);
80                 return 0;
81         }
82 +
83 +       /* network invalidation by Lustre */
84 +       if (dentry->d_flags & DCACHE_LUSTRE_INVALID) {
85 +               spin_unlock(&dcache_lock);
86 +               return 0;
87 +       }
88 +
89         /*
90          * Check whether to do a partial shrink_dcache
91          * to get rid of unused child entries.
92 @@ -859,13 +866,19 @@ void d_delete(struct dentry * dentry)
93   * Adds a dentry to the hash according to its name.
94   */
95   
96 -void d_rehash(struct dentry * entry)
97 +void __d_rehash(struct dentry * entry, int lock)
98  {
99         struct list_head *list = d_hash(entry->d_parent, entry->d_name.hash);
100         if (!list_empty(&entry->d_hash)) BUG();
101 -       spin_lock(&dcache_lock);
102 +       if (lock) spin_lock(&dcache_lock);
103         list_add(&entry->d_hash, list);
104 -       spin_unlock(&dcache_lock);
105 +       if (lock) spin_unlock(&dcache_lock);
106 +}
107 +EXPORT_SYMBOL(__d_rehash);
108 +
109 +void d_rehash(struct dentry * entry)
110 +{
111 +       __d_rehash(entry, 1);
112  }
113  
114  #define do_switch(x,y) do { \
115 --- linux-2.4.18-p4smp/fs/namespace.c~vfs_intent-2.4.18-18-chaos65      2002-06-25 22:16:14.000000000 -0600
116 +++ linux-2.4.18-p4smp-braam/fs/namespace.c     2003-07-09 13:20:37.000000000 -0600
117 @@ -99,6 +99,7 @@ static void detach_mnt(struct vfsmount *
118  {
119         old_nd->dentry = mnt->mnt_mountpoint;
120         old_nd->mnt = mnt->mnt_parent;
121 +       UNPIN(old_nd->dentry, old_nd->mnt, 1);
122         mnt->mnt_parent = mnt;
123         mnt->mnt_mountpoint = mnt->mnt_root;
124         list_del_init(&mnt->mnt_child);
125 @@ -110,6 +111,7 @@ static void attach_mnt(struct vfsmount *
126  {
127         mnt->mnt_parent = mntget(nd->mnt);
128         mnt->mnt_mountpoint = dget(nd->dentry);
129 +       PIN(nd->dentry, nd->mnt, 1);
130         list_add(&mnt->mnt_hash, mount_hashtable+hash(nd->mnt, nd->dentry));
131         list_add(&mnt->mnt_child, &nd->mnt->mnt_mounts);
132         nd->dentry->d_mounted++;
133 @@ -485,14 +487,17 @@ static int do_loopback(struct nameidata 
134  {
135         struct nameidata old_nd;
136         struct vfsmount *mnt = NULL;
137 +       struct lookup_intent it = { .it_op = IT_GETATTR };
138         int err = mount_is_safe(nd);
139         if (err)
140                 return err;
141         if (!old_name || !*old_name)
142                 return -EINVAL;
143 -       err = path_lookup(old_name, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &old_nd);
144 -       if (err)
145 +       err = path_lookup_it(old_name, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &old_nd, &it);
146 +       if (err) {
147 +               intent_release(&it);
148                 return err;
149 +       }
150  
151         down_write(&current->namespace->sem);
152         err = -EINVAL;
153 @@ -515,6 +520,7 @@ static int do_loopback(struct nameidata 
154         }
155  
156         up_write(&current->namespace->sem);
157 +       intent_release(&it);
158         path_release(&old_nd);
159         return err;
160  }
161 @@ -698,7 +704,8 @@ long do_mount(char * dev_name, char * di
162                   unsigned long flags, void *data_page)
163  {
164         struct nameidata nd;
165 -       int retval = 0;
166 +       struct lookup_intent it = { .it_op = IT_GETATTR };
167 +       int retval = 0;
168         int mnt_flags = 0;
169  
170         /* Discard magic */
171 @@ -722,10 +729,11 @@ long do_mount(char * dev_name, char * di
172         flags &= ~(MS_NOSUID|MS_NOEXEC|MS_NODEV);
173  
174         /* ... and get the mountpoint */
175 -       retval = path_lookup(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd);
176 -       if (retval)
177 +       retval = path_lookup_it(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd, &it);
178 +       if (retval) {
179 +               intent_release(&it);
180                 return retval;
181 -
182 +       }
183         if (flags & MS_REMOUNT)
184                 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
185                                     data_page);
186 @@ -736,6 +744,8 @@ long do_mount(char * dev_name, char * di
187         else
188                 retval = do_add_mount(&nd, type_page, flags, mnt_flags,
189                                       dev_name, data_page);
190 +
191 +       intent_release(&it);
192         path_release(&nd);
193         return retval;
194  }
195 @@ -901,6 +911,8 @@ asmlinkage long sys_pivot_root(const cha
196  {
197         struct vfsmount *tmp;
198         struct nameidata new_nd, old_nd, parent_nd, root_parent, user_nd;
199 +       struct lookup_intent new_it = { .it_op = IT_GETATTR };
200 +       struct lookup_intent old_it = { .it_op = IT_GETATTR };
201         int error;
202  
203         if (!capable(CAP_SYS_ADMIN))
204 @@ -908,14 +920,14 @@ asmlinkage long sys_pivot_root(const cha
205  
206         lock_kernel();
207  
208 -       error = __user_walk(new_root, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &new_nd);
209 +       error = __user_walk_it(new_root, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &new_nd, &new_it);
210         if (error)
211                 goto out0;
212         error = -EINVAL;
213         if (!check_mnt(new_nd.mnt))
214                 goto out1;
215  
216 -       error = __user_walk(put_old, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &old_nd);
217 +       error = __user_walk_it(put_old, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &old_nd, &old_it);
218         if (error)
219                 goto out1;
220  
221 @@ -970,8 +982,10 @@ out2:
222         up(&old_nd.dentry->d_inode->i_zombie);
223         up_write(&current->namespace->sem);
224         path_release(&user_nd);
225 +       intent_release(&old_it);
226         path_release(&old_nd);
227  out1:
228 +       intent_release(&new_it);
229         path_release(&new_nd);
230  out0:
231         unlock_kernel();
232 --- linux-2.4.18-p4smp/fs/namei.c~vfs_intent-2.4.18-18-chaos65  2003-07-09 12:17:30.000000000 -0600
233 +++ linux-2.4.18-p4smp-braam/fs/namei.c 2003-07-09 13:20:37.000000000 -0600
234 @@ -94,6 +94,13 @@
235   * XEmacs seems to be relying on it...
236   */
237  
238 +void intent_release(struct lookup_intent *it)
239 +{
240 +       if (it && it->it_op_release)
241 +               it->it_op_release(it);
242 +
243 +}
244 +
245  /* In order to reduce some races, while at the same time doing additional
246   * checking and hopefully speeding things up, we copy filenames to the
247   * kernel data space before using them..
248 @@ -260,10 +267,19 @@ void path_release(struct nameidata *nd)
249   * Internal lookup() using the new generic dcache.
250   * SMP-safe
251   */
252 -static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name, int flags)
253 +static struct dentry *cached_lookup(struct dentry *parent, struct qstr *name,
254 +                                   int flags, struct lookup_intent *it)
255  {
256         struct dentry * dentry = d_lookup(parent, name);
257  
258 +       if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
259 +               if (!dentry->d_op->d_revalidate_it(dentry, flags, it) &&
260 +                   !d_invalidate(dentry)) {
261 +                       dput(dentry);
262 +                       dentry = NULL;
263 +               }
264 +               return dentry;
265 +       } else
266         if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
267                 if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) {
268                         dput(dentry);
269 @@ -281,11 +297,14 @@ static struct dentry * cached_lookup(str
270   * make sure that nobody added the entry to the dcache in the meantime..
271   * SMP-safe
272   */
273 -static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, int flags)
274 +static struct dentry *real_lookup(struct dentry *parent, struct qstr *name,
275 +                                 int flags, struct lookup_intent *it)
276  {
277         struct dentry * result;
278         struct inode *dir = parent->d_inode;
279  
280 +again:
281 +
282         down(&dir->i_sem);
283         /*
284          * First re-do the cached lookup just in case it was created
285 @@ -300,6 +319,9 @@ static struct dentry * real_lookup(struc
286                 result = ERR_PTR(-ENOMEM);
287                 if (dentry) {
288                         lock_kernel();
289 +                       if (dir->i_op->lookup_it)
290 +                               result = dir->i_op->lookup_it(dir, dentry, it, flags);
291 +                       else
292                         result = dir->i_op->lookup(dir, dentry);
293                         unlock_kernel();
294                         if (result)
295 @@ -321,6 +343,12 @@ static struct dentry * real_lookup(struc
296                         dput(result);
297                         result = ERR_PTR(-ENOENT);
298                 }
299 +       } else if (result->d_op && result->d_op->d_revalidate_it) {
300 +               if (!result->d_op->d_revalidate_it(result, flags, it) &&
301 +                   !d_invalidate(result)) {
302 +                       dput(result);
303 +                       goto again;
304 +               }
305         }
306         return result;
307  }
308 @@ -334,7 +362,8 @@ int max_recursive_link = 5;
309   * Without that kind of total limit, nasty chains of consecutive
310   * symlinks can cause almost arbitrarily long lookups. 
311   */
312 -static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
313 +static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd,
314 +                                struct lookup_intent *it)
315  {
316         int err;
317         if (current->link_count >= max_recursive_link)
318 @@ -348,10 +377,21 @@ static inline int do_follow_link(struct 
319         current->link_count++;
320         current->total_link_count++;
321         UPDATE_ATIME(dentry->d_inode);
322 -       err = dentry->d_inode->i_op->follow_link(dentry, nd);
323 +       nd->it = it;
324 +       if (dentry->d_inode->i_op->follow_link2)
325 +               err = dentry->d_inode->i_op->follow_link2(dentry, nd, it);
326 +       else
327 +               err = dentry->d_inode->i_op->follow_link(dentry, nd);
328 +       if (!err && it != NULL && !(it->it_int_flags & IT_FL_FOLLOWED)) {
329 +               /* vfs_follow_link was never called */
330 +               intent_release(it);
331 +               path_release(nd);
332 +               err = -ENOLINK;
333 +       }
334         current->link_count--;
335         return err;
336  loop:
337 +       intent_release(it);
338         path_release(nd);
339         return -ELOOP;
340  }
341 @@ -381,15 +421,26 @@ int follow_up(struct vfsmount **mnt, str
342         return __follow_up(mnt, dentry);
343  }
344  
345 -static inline int __follow_down(struct vfsmount **mnt, struct dentry **dentry)
346 +static inline int __follow_down(struct vfsmount **mnt, struct dentry **dentry,
347 +                               struct lookup_intent *it)
348  {
349         struct vfsmount *mounted;
350  
351         spin_lock(&dcache_lock);
352         mounted = lookup_mnt(*mnt, *dentry);
353         if (mounted) {
354 +               int opc = 0, mode = 0;
355                 *mnt = mntget(mounted);
356                 spin_unlock(&dcache_lock);
357 +               if (it) {
358 +                       opc = it->it_op;
359 +                       mode = it->it_mode;
360 +               }
361 +               intent_release(it);
362 +               if (it) {
363 +                       it->it_op = opc;
364 +                       it->it_mode = mode;
365 +               }
366                 dput(*dentry);
367                 mntput(mounted->mnt_parent);
368                 *dentry = dget(mounted->mnt_root);
369 @@ -401,7 +452,7 @@ static inline int __follow_down(struct v
370  
371  int follow_down(struct vfsmount **mnt, struct dentry **dentry)
372  {
373 -       return __follow_down(mnt,dentry);
374 +       return __follow_down(mnt,dentry,NULL);
375  }
376   
377  static inline void follow_dotdot(struct nameidata *nd)
378 @@ -437,7 +488,7 @@ static inline void follow_dotdot(struct 
379                 mntput(nd->mnt);
380                 nd->mnt = parent;
381         }
382 -       while (d_mountpoint(nd->dentry) && __follow_down(&nd->mnt, &nd->dentry))
383 +       while (d_mountpoint(nd->dentry) && __follow_down(&nd->mnt, &nd->dentry, NULL))
384                 ;
385  }
386  
387 @@ -449,7 +500,8 @@ static inline void follow_dotdot(struct 
388   *
389   * We expect 'base' to be positive and a directory.
390   */
391 -int link_path_walk(const char * name, struct nameidata *nd)
392 +int link_path_walk_it(const char *name, struct nameidata *nd,
393 +                     struct lookup_intent *it)
394  {
395         struct dentry *dentry;
396         struct inode *inode;
397 @@ -526,18 +578,18 @@ int link_path_walk(const char * name, st
398                                 break;
399                 }
400                 /* This does the actual lookups.. */
401 -               dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
402 +               dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE, NULL);
403                 if (!dentry) {
404                         err = -EWOULDBLOCKIO;
405                         if (atomic)
406                                 break;
407 -                       dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
408 +                       dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE, NULL);
409                         err = PTR_ERR(dentry);
410                         if (IS_ERR(dentry))
411                                 break;
412                 }
413                 /* Check mountpoints.. */
414 -               while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry))
415 +               while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry, NULL))
416                         ;
417  
418                 err = -ENOENT;
419 @@ -548,8 +600,8 @@ int link_path_walk(const char * name, st
420                 if (!inode->i_op)
421                         goto out_dput;
422  
423 -               if (inode->i_op->follow_link) {
424 -                       err = do_follow_link(dentry, nd);
425 +               if (inode->i_op->follow_link || inode->i_op->follow_link2) {
426 +                       err = do_follow_link(dentry, nd, NULL);
427                         dput(dentry);
428                         if (err)
429                                 goto return_err;
430 @@ -565,7 +617,7 @@ int link_path_walk(const char * name, st
431                         nd->dentry = dentry;
432                 }
433                 err = -ENOTDIR; 
434 -               if (!inode->i_op->lookup)
435 +               if (!inode->i_op->lookup && !inode->i_op->lookup_it)
436                         break;
437                 continue;
438                 /* here ends the main loop */
439 @@ -592,22 +644,23 @@ last_component:
440                         if (err < 0)
441                                 break;
442                 }
443 -               dentry = cached_lookup(nd->dentry, &this, 0);
444 +               dentry = cached_lookup(nd->dentry, &this, 0, it);
445                 if (!dentry) {
446                         err = -EWOULDBLOCKIO;
447                         if (atomic)
448                                 break;
449 -                       dentry = real_lookup(nd->dentry, &this, 0);
450 +                       dentry = real_lookup(nd->dentry, &this, 0, it);
451                         err = PTR_ERR(dentry);
452                         if (IS_ERR(dentry))
453                                 break;
454                 }
455 -               while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry))
456 +               while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry, it))
457                         ;
458                 inode = dentry->d_inode;
459                 if ((lookup_flags & LOOKUP_FOLLOW)
460 -                   && inode && inode->i_op && inode->i_op->follow_link) {
461 -                       err = do_follow_link(dentry, nd);
462 +                   && inode && inode->i_op &&
463 +                   (inode->i_op->follow_link || inode->i_op->follow_link2)) {
464 +                       err = do_follow_link(dentry, nd, it);
465                         dput(dentry);
466                         if (err)
467                                 goto return_err;
468 @@ -621,7 +674,8 @@ last_component:
469                         goto no_inode;
470                 if (lookup_flags & LOOKUP_DIRECTORY) {
471                         err = -ENOTDIR; 
472 -                       if (!inode->i_op || !inode->i_op->lookup)
473 +                       if (!inode->i_op ||
474 +                           (!inode->i_op->lookup && !inode->i_op->lookup_it))
475                                 break;
476                 }
477                 goto return_base;
478 @@ -645,7 +699,24 @@ return_reval:
479                  * Check the cached dentry for staleness.
480                  */
481                 dentry = nd->dentry;
482 -               if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
483 +       revalidate_again:
484 +               if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
485 +                       err = -ESTALE;
486 +                       if (!dentry->d_op->d_revalidate_it(dentry, 0, it)) {
487 +                               struct dentry *new;
488 +                               err = permission(dentry->d_parent->d_inode,
489 +                                                MAY_EXEC);
490 +                               if (err)
491 +                                       break;
492 +                               new = real_lookup(dentry->d_parent,
493 +                                                 &dentry->d_name, 0, NULL);
494 +                               d_invalidate(dentry);
495 +                               dput(dentry);
496 +                               dentry = new;
497 +                               goto revalidate_again;
498 +                       }
499 +               }
500 +               else if (dentry && dentry->d_op && dentry->d_op->d_revalidate){
501                         err = -ESTALE;
502                         if (!dentry->d_op->d_revalidate(dentry, 0)) {
503                                 d_invalidate(dentry);
504 @@ -658,15 +729,28 @@ out_dput:
505                 dput(dentry);
506                 break;
507         }
508 +       if (err)
509 +               intent_release(it);
510         path_release(nd);
511  return_err:
512         return err;
513  }
514  
515 +int link_path_walk(const char * name, struct nameidata *nd)
516 +{
517 +       return link_path_walk_it(name, nd, NULL);
518 +}
519 +
520 +int path_walk_it(const char * name, struct nameidata *nd, struct lookup_intent *it)
521 +{
522 +       current->total_link_count = 0;
523 +       return link_path_walk_it(name, nd, it);
524 +}
525 +
526  int path_walk(const char * name, struct nameidata *nd)
527  {
528         current->total_link_count = 0;
529 -       return link_path_walk(name, nd);
530 +       return link_path_walk_it(name, nd, NULL);
531  }
532  
533  /* SMP-safe */
534 @@ -751,6 +835,17 @@ walk_init_root(const char *name, struct 
535  }
536  
537  /* SMP-safe */
538 +int path_lookup_it(const char *path, unsigned flags, struct nameidata *nd,
539 +                  struct lookup_intent *it)
540 +{
541 +       int error = 0;
542 +       if (path_init(path, flags, nd))
543 +               error = path_walk_it(path, nd, it);
544 +       return error;
545 +}
546 +
547 +
548 +/* SMP-safe */
549  int path_lookup(const char *path, unsigned flags, struct nameidata *nd)
550  {
551         int error = 0;
552 @@ -765,6 +860,7 @@ int path_init(const char *name, unsigned
553  {
554         nd->last_type = LAST_ROOT; /* if there are only slashes... */
555         nd->flags = flags;
556 +       nd->it = NULL;
557         if (*name=='/')
558                 return walk_init_root(name,nd);
559         read_lock(&current->fs->lock);
560 @@ -779,7 +875,8 @@ int path_init(const char *name, unsigned
561   * needs parent already locked. Doesn't follow mounts.
562   * SMP-safe.
563   */
564 -struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
565 +struct dentry * lookup_hash_it(struct qstr *name, struct dentry * base,
566 +                              struct lookup_intent *it)
567  {
568         struct dentry * dentry;
569         struct inode *inode;
570 @@ -802,13 +899,16 @@ struct dentry * lookup_hash(struct qstr 
571                         goto out;
572         }
573  
574 -       dentry = cached_lookup(base, name, 0);
575 +       dentry = cached_lookup(base, name, 0, it);
576         if (!dentry) {
577                 struct dentry *new = d_alloc(base, name);
578                 dentry = ERR_PTR(-ENOMEM);
579                 if (!new)
580                         goto out;
581                 lock_kernel();
582 +               if (inode->i_op->lookup_it)
583 +                       dentry = inode->i_op->lookup_it(inode, new, it, 0);
584 +               else
585                 dentry = inode->i_op->lookup(inode, new);
586                 unlock_kernel();
587                 if (!dentry)
588 @@ -820,6 +920,12 @@ out:
589         return dentry;
590  }
591  
592 +struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
593 +{
594 +       return lookup_hash_it(name, base, NULL);
595 +}
596 +
597 +
598  /* SMP-safe */
599  struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
600  {
601 @@ -841,7 +947,7 @@ struct dentry * lookup_one_len(const cha
602         }
603         this.hash = end_name_hash(hash);
604  
605 -       return lookup_hash(&this, base);
606 +       return lookup_hash_it(&this, base, NULL);
607  access:
608         return ERR_PTR(-EACCES);
609  }
610 @@ -872,6 +978,23 @@ int __user_walk(const char *name, unsign
611         return err;
612  }
613  
614 +int __user_walk_it(const char *name, unsigned flags, struct nameidata *nd,
615 +                  struct lookup_intent *it)
616 +{
617 +       char *tmp;
618 +       int err;
619 +
620 +       tmp = getname(name);
621 +       err = PTR_ERR(tmp);
622 +       if (!IS_ERR(tmp)) {
623 +               err = 0;
624 +               if (path_init(tmp, flags, nd))
625 +                       err = path_walk_it(tmp, nd, it);
626 +               putname(tmp);
627 +       }
628 +       return err;
629 +}
630 +
631  /*
632   * It's inline, so penalty for filesystems that don't use sticky bit is
633   * minimal.
634 @@ -969,6 +1092,37 @@ static inline int lookup_flags(unsigned 
635         return retval;
636  }
637  
638 +static int vfs_create_it(struct inode *dir, struct dentry *dentry, int mode,
639 +                        struct lookup_intent *it)
640 +{
641 +       int error;
642 +
643 +       mode &= S_IALLUGO;
644 +       mode |= S_IFREG;
645 +
646 +       down(&dir->i_zombie);
647 +       error = may_create(dir, dentry);
648 +       if (error)
649 +               goto exit_lock;
650 +
651 +       error = -EACCES;        /* shouldn't it be ENOSYS? */
652 +       if (!dir->i_op || (!dir->i_op->create && !dir->i_op->create_it))
653 +               goto exit_lock;
654 +
655 +       DQUOT_INIT(dir);
656 +       lock_kernel();
657 +       if (dir->i_op->create_it)
658 +               error = dir->i_op->create_it(dir, dentry, mode, it);
659 +       else
660 +               error = dir->i_op->create(dir, dentry, mode);
661 +       unlock_kernel();
662 +exit_lock:
663 +       up(&dir->i_zombie);
664 +       if (!error)
665 +               inode_dir_notify(dir, DN_CREATE);
666 +       return error;
667 +}
668 +
669  int vfs_create(struct inode *dir, struct dentry *dentry, int mode)
670  {
671         int error;
672 @@ -987,7 +1141,7 @@ int vfs_create(struct inode *dir, struct
673  
674         DQUOT_INIT(dir);
675         lock_kernel();
676 -       error = dir->i_op->create(dir, dentry, mode);
677 +       error = dir->i_op->create(dir, dentry, mode);
678         unlock_kernel();
679  exit_lock:
680         up(&dir->i_zombie);
681 @@ -1045,14 +1199,17 @@ int may_open(struct nameidata *nd, int a
682          return get_lease(inode, flag);
683  }
684  
685 -struct file *filp_open(const char * pathname, int open_flags, int mode)
686 +extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
687 +                                  int flags, struct lookup_intent *it);
688 +
689 +struct file *filp_open(const char * pathname, int open_flags, int mode)
690  {
691         int acc_mode, error = 0;
692 -       struct inode *inode;
693         struct dentry *dentry;
694         struct dentry *dir;
695         int flag = open_flags;
696         struct nameidata nd;
697 +       struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = open_flags };
698         int count = 0;
699         
700         if (!capable(CAP_SYS_ADMIN))
701 @@ -1069,7 +1226,7 @@ struct file *filp_open(const char * path
702          * The simplest case - just a plain lookup.
703          */
704         if (!(flag & O_CREAT)) {
705 -               error = path_lookup(pathname, lookup_flags(flag), &nd);
706 +               error = path_lookup_it(pathname, lookup_flags(flag), &nd, &it);
707                 if (error)
708                         return ERR_PTR(error);
709                 dentry = nd.dentry;
710 @@ -1079,6 +1236,8 @@ struct file *filp_open(const char * path
711         /*
712          * Create - we need to know the parent.
713          */
714 +       it.it_mode = mode;
715 +       it.it_op |= IT_CREAT;
716         error = path_lookup(pathname, LOOKUP_PARENT, &nd);
717         if (error)
718                 return ERR_PTR(error);
719 @@ -1094,7 +1253,7 @@ struct file *filp_open(const char * path
720  
721         dir = nd.dentry;
722         down(&dir->d_inode->i_sem);
723 -       dentry = lookup_hash(&nd.last, nd.dentry);
724 +       dentry = lookup_hash_it(&nd.last, nd.dentry, &it);
725  
726  do_last:
727         error = PTR_ERR(dentry);
728 @@ -1103,10 +1262,11 @@ do_last:
729                 goto exit;
730         }
731  
732 +       it.it_mode = mode;
733         /* Negative dentry, just create the file */
734         if (!dentry->d_inode) {
735 -               error = vfs_create(dir->d_inode, dentry,
736 -                                  mode & ~current->fs->umask);
737 +               error = vfs_create_it(dir->d_inode, dentry,
738 +                                  mode & ~current->fs->umask, &it);
739                 up(&dir->d_inode->i_sem);
740                 dput(nd.dentry);
741                 nd.dentry = dentry;
742 @@ -1132,12 +1292,12 @@ do_last:
743                 error = -ELOOP;
744                 if (flag & O_NOFOLLOW)
745                         goto exit_dput;
746 -               while (__follow_down(&nd.mnt,&dentry) && d_mountpoint(dentry));
747 +               while (__follow_down(&nd.mnt,&dentry, &it) && d_mountpoint(dentry));
748         }
749         error = -ENOENT;
750         if (!dentry->d_inode)
751                 goto exit_dput;
752 -       if (dentry->d_inode->i_op && dentry->d_inode->i_op->follow_link)
753 +       if (dentry->d_inode->i_op && (dentry->d_inode->i_op->follow_link))
754                 goto do_link;
755  
756         dput(nd.dentry);
757 @@ -1152,11 +1312,13 @@ ok:
758         if (!S_ISREG(nd.dentry->d_inode->i_mode))
759                 open_flags &= ~O_TRUNC;
760  
761 -        return dentry_open(nd.dentry, nd.mnt, open_flags);
762 +       return dentry_open_it(nd.dentry, nd.mnt, open_flags, &it);
763  
764  exit_dput:
765 +       intent_release(&it);
766         dput(dentry);
767  exit:
768 +       intent_release(&it);
769         path_release(&nd);
770         return ERR_PTR(error);
771  
772 @@ -1175,10 +1337,19 @@ do_link:
773          * are done. Procfs-like symlinks just set LAST_BIND.
774          */
775         UPDATE_ATIME(dentry->d_inode);
776 -       error = dentry->d_inode->i_op->follow_link(dentry, &nd);
777 +       nd.it = &it;
778 +       error = dentry->d_inode->i_op->follow_link(dentry, &nd);
779 +       if (error) {
780 +               intent_release(&it);
781 +       } else if (!(it.it_int_flags & IT_FL_FOLLOWED)) {
782 +               /* vfs_follow_link was never called */
783 +               intent_release(&it);
784 +               path_release(&nd);
785 +               error = -ENOLINK;
786 +       }
787         dput(dentry);
788         if (error)
789 -               return error;
790 +               return ERR_PTR(error);
791         if (nd.last_type == LAST_BIND) {
792                 dentry = nd.dentry;
793                 goto ok;
794 @@ -1197,13 +1368,15 @@ do_link:
795         }
796         dir = nd.dentry;
797         down(&dir->d_inode->i_sem);
798 -       dentry = lookup_hash(&nd.last, nd.dentry);
799 +       dentry = lookup_hash_it(&nd.last, nd.dentry, &it);
800         putname(nd.last.name);
801         goto do_last;
802  }
803  
804 +
805  /* SMP-safe */
806 -static struct dentry *lookup_create(struct nameidata *nd, int is_dir)
807 +static struct dentry *lookup_create(struct nameidata *nd, int is_dir,
808 +                                   struct lookup_intent *it)
809  {
810         struct dentry *dentry;
811  
812 @@ -1211,7 +1384,7 @@ static struct dentry *lookup_create(stru
813         dentry = ERR_PTR(-EEXIST);
814         if (nd->last_type != LAST_NORM)
815                 goto fail;
816 -       dentry = lookup_hash(&nd->last, nd->dentry);
817 +       dentry = lookup_hash_it(&nd->last, nd->dentry, it);
818         if (IS_ERR(dentry))
819                 goto fail;
820         if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
821 @@ -1267,7 +1440,16 @@ asmlinkage long sys_mknod(const char * f
822         error = path_lookup(tmp, LOOKUP_PARENT, &nd);
823         if (error)
824                 goto out;
825 -       dentry = lookup_create(&nd, 0);
826 +
827 +       if (nd.dentry->d_inode->i_op->mknod_raw) {
828 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
829 +               error = op->mknod_raw(&nd, mode, dev);
830 +               /* the file system wants to use normal vfs path now */
831 +               if (error != -EOPNOTSUPP)
832 +                       goto out2;
833 +       }
834 +
835 +       dentry = lookup_create(&nd, 0, NULL);
836         error = PTR_ERR(dentry);
837  
838         mode &= ~current->fs->umask;
839 @@ -1288,6 +1470,7 @@ asmlinkage long sys_mknod(const char * f
840                 dput(dentry);
841         }
842         up(&nd.dentry->d_inode->i_sem);
843 +out2:
844         path_release(&nd);
845  out:
846         putname(tmp);
847 @@ -1335,7 +1518,14 @@ asmlinkage long sys_mkdir(const char * p
848                 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
849                 if (error)
850                         goto out;
851 -               dentry = lookup_create(&nd, 1);
852 +               if (nd.dentry->d_inode->i_op->mkdir_raw) {
853 +                       struct inode_operations *op = nd.dentry->d_inode->i_op;
854 +                       error = op->mkdir_raw(&nd, mode);
855 +                       /* the file system wants to use normal vfs path now */
856 +                       if (error != -EOPNOTSUPP)
857 +                               goto out2;
858 +               }
859 +               dentry = lookup_create(&nd, 1, NULL);
860                 error = PTR_ERR(dentry);
861                 if (!IS_ERR(dentry)) {
862                         error = vfs_mkdir(nd.dentry->d_inode, dentry,
863 @@ -1343,6 +1533,7 @@ asmlinkage long sys_mkdir(const char * p
864                         dput(dentry);
865                 }
866                 up(&nd.dentry->d_inode->i_sem);
867 +out2:
868                 path_release(&nd);
869  out:
870                 putname(tmp);
871 @@ -1443,8 +1634,16 @@ asmlinkage long sys_rmdir(const char * p
872                         error = -EBUSY;
873                         goto exit1;
874         }
875 +       if (nd.dentry->d_inode->i_op->rmdir_raw) {
876 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
877 +
878 +               error = op->rmdir_raw(&nd);
879 +               /* the file system wants to use normal vfs path now */
880 +               if (error != -EOPNOTSUPP)
881 +                       goto exit1;
882 +       }
883         down(&nd.dentry->d_inode->i_sem);
884 -       dentry = lookup_hash(&nd.last, nd.dentry);
885 +       dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
886         error = PTR_ERR(dentry);
887         if (!IS_ERR(dentry)) {
888                 error = vfs_rmdir(nd.dentry->d_inode, dentry);
889 @@ -1502,8 +1701,15 @@ asmlinkage long sys_unlink(const char * 
890         error = -EISDIR;
891         if (nd.last_type != LAST_NORM)
892                 goto exit1;
893 +       if (nd.dentry->d_inode->i_op->unlink_raw) {
894 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
895 +               error = op->unlink_raw(&nd);
896 +               /* the file system wants to use normal vfs path now */
897 +               if (error != -EOPNOTSUPP)
898 +                       goto exit1;
899 +       }
900         down(&nd.dentry->d_inode->i_sem);
901 -       dentry = lookup_hash(&nd.last, nd.dentry);
902 +       dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
903         error = PTR_ERR(dentry);
904         if (!IS_ERR(dentry)) {
905                 /* Why not before? Because we want correct error value */
906 @@ -1570,15 +1776,23 @@ asmlinkage long sys_symlink(const char *
907                 error = path_lookup(to, LOOKUP_PARENT, &nd);
908                 if (error)
909                         goto out;
910 -               dentry = lookup_create(&nd, 0);
911 +               if (nd.dentry->d_inode->i_op->symlink_raw) {
912 +                       struct inode_operations *op = nd.dentry->d_inode->i_op;
913 +                       error = op->symlink_raw(&nd, from);
914 +                       /* the file system wants to use normal vfs path now */
915 +                       if (error != -EOPNOTSUPP)
916 +                               goto out2;
917 +               }
918 +               dentry = lookup_create(&nd, 0, NULL);
919                 error = PTR_ERR(dentry);
920                 if (!IS_ERR(dentry)) {
921                         error = vfs_symlink(nd.dentry->d_inode, dentry, from);
922                         dput(dentry);
923                 }
924                 up(&nd.dentry->d_inode->i_sem);
925 +       out2:
926                 path_release(&nd);
927 -out:
928 +       out:
929                 putname(to);
930         }
931         putname(from);
932 @@ -1654,7 +1868,14 @@ asmlinkage long sys_link(const char * ol
933                 error = -EXDEV;
934                 if (old_nd.mnt != nd.mnt)
935                         goto out_release;
936 -               new_dentry = lookup_create(&nd, 0);
937 +               if (nd.dentry->d_inode->i_op->link_raw) {
938 +                       struct inode_operations *op = nd.dentry->d_inode->i_op;
939 +                       error = op->link_raw(&old_nd, &nd);
940 +                       /* the file system wants to use normal vfs path now */
941 +                       if (error != -EOPNOTSUPP)
942 +                               goto out_release;
943 +               }
944 +               new_dentry = lookup_create(&nd, 0, NULL);
945                 error = PTR_ERR(new_dentry);
946                 if (!IS_ERR(new_dentry)) {
947                         error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
948 @@ -1698,7 +1919,7 @@ exit:
949   *        locking].
950   */
951  int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
952 -              struct inode *new_dir, struct dentry *new_dentry)
953 +                  struct inode *new_dir, struct dentry *new_dentry)
954  {
955         int error;
956         struct inode *target;
957 @@ -1777,7 +1998,7 @@ out_unlock:
958  }
959  
960  int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
961 -              struct inode *new_dir, struct dentry *new_dentry)
962 +                    struct inode *new_dir, struct dentry *new_dentry)
963  {
964         int error;
965  
966 @@ -1865,9 +2086,18 @@ static inline int do_rename(const char *
967         if (newnd.last_type != LAST_NORM)
968                 goto exit2;
969  
970 +       if (old_dir->d_inode->i_op->rename_raw) {
971 +               lock_kernel();
972 +               error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
973 +               unlock_kernel();
974 +               /* the file system wants to use normal vfs path now */
975 +               if (error != -EOPNOTSUPP)
976 +                       goto exit2;
977 +       }
978 +
979         double_lock(new_dir, old_dir);
980  
981 -       old_dentry = lookup_hash(&oldnd.last, old_dir);
982 +       old_dentry = lookup_hash_it(&oldnd.last, old_dir, NULL);
983         error = PTR_ERR(old_dentry);
984         if (IS_ERR(old_dentry))
985                 goto exit3;
986 @@ -1883,16 +2113,16 @@ static inline int do_rename(const char *
987                 if (newnd.last.name[newnd.last.len])
988                         goto exit4;
989         }
990 -       new_dentry = lookup_hash(&newnd.last, new_dir);
991 +       new_dentry = lookup_hash_it(&newnd.last, new_dir, NULL);
992         error = PTR_ERR(new_dentry);
993         if (IS_ERR(new_dentry))
994                 goto exit4;
995  
996 +
997         lock_kernel();
998         error = vfs_rename(old_dir->d_inode, old_dentry,
999                                    new_dir->d_inode, new_dentry);
1000         unlock_kernel();
1001 -
1002         dput(new_dentry);
1003  exit4:
1004         dput(old_dentry);
1005 @@ -1943,12 +2173,19 @@ out:
1006  }
1007  
1008  static inline int
1009 -__vfs_follow_link(struct nameidata *nd, const char *link)
1010 +__vfs_follow_link(struct nameidata *nd, const char *link,
1011 +                 struct lookup_intent *it)
1012  {
1013         int res = 0;
1014         char *name;
1015         if (IS_ERR(link))
1016                 goto fail;
1017 +       if (it == NULL)
1018 +               it = nd->it;
1019 +       else if (it != nd->it)
1020 +               printk("it != nd->it: tell phil@clusterfs.com\n");
1021 +       if (it != NULL)
1022 +               it->it_int_flags |= IT_FL_FOLLOWED;
1023  
1024         if (*link == '/') {
1025                 path_release(nd);
1026 @@ -1956,7 +2193,7 @@ __vfs_follow_link(struct nameidata *nd, 
1027                         /* weird __emul_prefix() stuff did it */
1028                         goto out;
1029         }
1030 -       res = link_path_walk(link, nd);
1031 +       res = link_path_walk_it(link, nd, it);
1032  out:
1033         if (current->link_count || res || nd->last_type!=LAST_NORM)
1034                 return res;
1035 @@ -1978,7 +2215,13 @@ fail:
1036  
1037  int vfs_follow_link(struct nameidata *nd, const char *link)
1038  {
1039 -       return __vfs_follow_link(nd, link);
1040 +       return __vfs_follow_link(nd, link, NULL);
1041 +}
1042 +
1043 +int vfs_follow_link_it(struct nameidata *nd, const char *link,
1044 +                      struct lookup_intent *it)
1045 +{
1046 +       return __vfs_follow_link(nd, link, it);
1047  }
1048  
1049  /* get the link contents into pagecache */
1050 @@ -2020,7 +2263,7 @@ int page_follow_link(struct dentry *dent
1051  {
1052         struct page *page = NULL;
1053         char *s = page_getlink(dentry, &page);
1054 -       int res = __vfs_follow_link(nd, s);
1055 +       int res = __vfs_follow_link(nd, s, NULL);
1056         if (page) {
1057                 kunmap(page);
1058                 page_cache_release(page);
1059 --- linux-2.4.18-p4smp/fs/open.c~vfs_intent-2.4.18-18-chaos65   2003-07-09 12:17:30.000000000 -0600
1060 +++ linux-2.4.18-p4smp-braam/fs/open.c  2003-07-09 13:20:37.000000000 -0600
1061 @@ -19,6 +19,8 @@
1062  #include <asm/uaccess.h>
1063  
1064  #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
1065 +extern int path_walk_it(const char *name, struct nameidata *nd,
1066 +                       struct lookup_intent *it);
1067  
1068  int vfs_statfs(struct super_block *sb, struct statfs *buf)
1069  {
1070 @@ -95,9 +97,10 @@ void fd_install(unsigned int fd, struct 
1071         write_unlock(&files->file_lock);
1072  }
1073  
1074 -int do_truncate(struct dentry *dentry, loff_t length)
1075 +int do_truncate(struct dentry *dentry, loff_t length, int called_from_open)
1076  {
1077         struct inode *inode = dentry->d_inode;
1078 +       struct inode_operations *op = dentry->d_inode->i_op;
1079         int error;
1080         struct iattr newattrs;
1081  
1082 @@ -108,7 +111,13 @@ int do_truncate(struct dentry *dentry, l
1083         down(&inode->i_sem);
1084         newattrs.ia_size = length;
1085         newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
1086 -       error = notify_change(dentry, &newattrs);
1087 +       if (called_from_open)
1088 +               newattrs.ia_valid |= ATTR_FROM_OPEN;
1089 +       if (op->setattr_raw) {
1090 +               newattrs.ia_valid |= ATTR_RAW;
1091 +               error = op->setattr_raw(inode, &newattrs);
1092 +       } else
1093 +               error = notify_change(dentry, &newattrs);
1094         up(&inode->i_sem);
1095         return error;
1096  }
1097 @@ -118,12 +128,13 @@ static inline long do_sys_truncate(const
1098         struct nameidata nd;
1099         struct inode * inode;
1100         int error;
1101 +       struct lookup_intent it = { .it_op = IT_GETATTR };
1102  
1103         error = -EINVAL;
1104         if (length < 0) /* sorry, but loff_t says... */
1105                 goto out;
1106  
1107 -       error = user_path_walk(path, &nd);
1108 +       error = user_path_walk_it(path, &nd, &it);
1109         if (error)
1110                 goto out;
1111         inode = nd.dentry->d_inode;
1112 @@ -163,11 +174,13 @@ static inline long do_sys_truncate(const
1113         error = locks_verify_truncate(inode, NULL, length);
1114         if (!error) {
1115                 DQUOT_INIT(inode);
1116 -               error = do_truncate(nd.dentry, length);
1117 +               intent_release(&it);
1118 +               error = do_truncate(nd.dentry, length, 0);
1119         }
1120         put_write_access(inode);
1121  
1122  dput_and_out:
1123 +       intent_release(&it);
1124         path_release(&nd);
1125  out:
1126         return error;
1127 @@ -215,7 +228,7 @@ static inline long do_sys_ftruncate(unsi
1128  
1129         error = locks_verify_truncate(inode, file, length);
1130         if (!error)
1131 -               error = do_truncate(dentry, length);
1132 +               error = do_truncate(dentry, length, 0);
1133  out_putf:
1134         fput(file);
1135  out:
1136 @@ -260,11 +273,13 @@ asmlinkage long sys_utime(char * filenam
1137         struct inode * inode;
1138         struct iattr newattrs;
1139  
1140 -       error = user_path_walk(filename, &nd);
1141 +       error = user_path_walk_it(filename, &nd, NULL);
1142         if (error)
1143                 goto out;
1144         inode = nd.dentry->d_inode;
1145  
1146 +       /* this is safe without a Lustre lock because it only depends
1147 +          on the super block */
1148         error = -EROFS;
1149         if (IS_RDONLY(inode))
1150                 goto dput_and_out;
1151 @@ -279,11 +294,25 @@ asmlinkage long sys_utime(char * filenam
1152                         goto dput_and_out;
1153  
1154                 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
1155 -       } else {
1156 +       }
1157 +
1158 +       if (inode->i_op->setattr_raw) {
1159 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
1160 +
1161 +               newattrs.ia_valid |= ATTR_RAW;
1162 +               error = op->setattr_raw(inode, &newattrs);
1163 +               /* the file system wants to use normal vfs path now */
1164 +               if (error != -EOPNOTSUPP)
1165 +                       goto dput_and_out;
1166 +       }
1167 +
1168 +       error = -EPERM;
1169 +       if (!times) {
1170                 if (current->fsuid != inode->i_uid &&
1171                     (error = permission(inode,MAY_WRITE)) != 0)
1172                         goto dput_and_out;
1173         }
1174 +
1175         error = notify_change(nd.dentry, &newattrs);
1176  dput_and_out:
1177         path_release(&nd);
1178 @@ -304,12 +337,14 @@ asmlinkage long sys_utimes(char * filena
1179         struct inode * inode;
1180         struct iattr newattrs;
1181  
1182 -       error = user_path_walk(filename, &nd);
1183 +       error = user_path_walk_it(filename, &nd, NULL);
1184  
1185         if (error)
1186                 goto out;
1187         inode = nd.dentry->d_inode;
1188  
1189 +       /* this is safe without a Lustre lock because it only depends
1190 +          on the super block */
1191         error = -EROFS;
1192         if (IS_RDONLY(inode))
1193                 goto dput_and_out;
1194 @@ -324,7 +359,20 @@ asmlinkage long sys_utimes(char * filena
1195                 newattrs.ia_atime = times[0].tv_sec;
1196                 newattrs.ia_mtime = times[1].tv_sec;
1197                 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
1198 -       } else {
1199 +       }
1200 +
1201 +       if (inode->i_op->setattr_raw) {
1202 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
1203 +
1204 +               newattrs.ia_valid |= ATTR_RAW;
1205 +               error = op->setattr_raw(inode, &newattrs);
1206 +               /* the file system wants to use normal vfs path now */
1207 +               if (error != -EOPNOTSUPP)
1208 +                       goto dput_and_out;
1209 +       }
1210 +
1211 +       error = -EPERM;
1212 +       if (!utimes) {
1213                 if (current->fsuid != inode->i_uid &&
1214                     (error = permission(inode,MAY_WRITE)) != 0)
1215                         goto dput_and_out;
1216 @@ -347,6 +395,7 @@ asmlinkage long sys_access(const char * 
1217         int old_fsuid, old_fsgid;
1218         kernel_cap_t old_cap;
1219         int res;
1220 +       struct lookup_intent it = { .it_op = IT_GETATTR };
1221  
1222         if (mode & ~S_IRWXO)    /* where's F_OK, X_OK, W_OK, R_OK? */
1223                 return -EINVAL;
1224 @@ -364,13 +413,14 @@ asmlinkage long sys_access(const char * 
1225         else
1226                 current->cap_effective = current->cap_permitted;
1227  
1228 -       res = user_path_walk(filename, &nd);
1229 +       res = user_path_walk_it(filename, &nd, &it);
1230         if (!res) {
1231                 res = permission(nd.dentry->d_inode, mode);
1232                 /* SuS v2 requires we report a read only fs too */
1233                 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
1234                    && !special_file(nd.dentry->d_inode->i_mode))
1235                         res = -EROFS;
1236 +               intent_release(&it);
1237                 path_release(&nd);
1238         }
1239  
1240 @@ -385,8 +435,11 @@ asmlinkage long sys_chdir(const char * f
1241  {
1242         int error;
1243         struct nameidata nd;
1244 +       struct lookup_intent it = { .it_op = IT_GETATTR };
1245  
1246 -       error = __user_walk(filename,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd);
1247 +       error = __user_walk_it(filename,
1248 +                              LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,
1249 +                              &nd, &it);
1250         if (error)
1251                 goto out;
1252  
1253 @@ -397,6 +450,7 @@ asmlinkage long sys_chdir(const char * f
1254         set_fs_pwd(current->fs, nd.mnt, nd.dentry);
1255  
1256  dput_and_out:
1257 +       intent_release(&it);
1258         path_release(&nd);
1259  out:
1260         return error;
1261 @@ -436,9 +490,10 @@ asmlinkage long sys_chroot(const char * 
1262  {
1263         int error;
1264         struct nameidata nd;
1265 +       struct lookup_intent it = { .it_op = IT_GETATTR };
1266  
1267 -       error = __user_walk(filename, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
1268 -                     LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
1269 +       error = __user_walk_it(filename, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
1270 +                              LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd, &it);
1271         if (error)
1272                 goto out;
1273  
1274 @@ -454,6 +509,7 @@ asmlinkage long sys_chroot(const char * 
1275         set_fs_altroot();
1276         error = 0;
1277  dput_and_out:
1278 +       intent_release(&it);
1279         path_release(&nd);
1280  out:
1281         return error;
1282 @@ -508,6 +564,18 @@ asmlinkage long sys_chmod(const char * f
1283         if (IS_RDONLY(inode))
1284                 goto dput_and_out;
1285  
1286 +       if (inode->i_op->setattr_raw) {
1287 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
1288 +
1289 +               newattrs.ia_mode = mode;
1290 +               newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1291 +               newattrs.ia_valid |= ATTR_RAW;
1292 +               error = op->setattr_raw(inode, &newattrs);
1293 +               /* the file system wants to use normal vfs path now */
1294 +               if (error != -EOPNOTSUPP)
1295 +                       goto dput_and_out;
1296 +       }
1297 +
1298         error = -EPERM;
1299         if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1300                 goto dput_and_out;
1301 @@ -538,6 +606,20 @@ static int chown_common(struct dentry * 
1302         error = -EROFS;
1303         if (IS_RDONLY(inode))
1304                 goto out;
1305 +
1306 +       if (inode->i_op->setattr_raw) {
1307 +               struct inode_operations *op = dentry->d_inode->i_op;
1308 +
1309 +               newattrs.ia_uid = user;
1310 +               newattrs.ia_gid = group;
1311 +               newattrs.ia_valid = ATTR_UID | ATTR_GID | ATTR_CTIME;
1312 +               newattrs.ia_valid |= ATTR_RAW;
1313 +               error = op->setattr_raw(inode, &newattrs);
1314 +               /* the file system wants to use normal vfs path now */
1315 +               if (error != -EOPNOTSUPP)
1316 +                       return error;
1317 +       }
1318 +
1319         error = -EPERM;
1320         if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1321                 goto out;
1322 @@ -628,7 +710,8 @@ extern ssize_t do_readahead(struct file 
1323  /* for files over a certains size it doesn't pay to do readahead on open */
1324  #define READAHEAD_CUTOFF 48000
1325  
1326 -struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1327 +struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1328 +                           int flags, struct lookup_intent *it)
1329  {
1330         struct file * f;
1331         struct inode *inode;
1332 @@ -649,7 +732,7 @@ struct file *dentry_open(struct dentry *
1333                 error = locks_verify_locked(inode);
1334                 if (!error) {
1335                         DQUOT_INIT(inode);
1336 -                       error = do_truncate(dentry, 0);
1337 +                       error = do_truncate(dentry, 0, 1);
1338                 }
1339                 if (error || !(f->f_mode & FMODE_WRITE))
1340                         put_write_access(inode);
1341 @@ -679,7 +762,9 @@ struct file *dentry_open(struct dentry *
1342         }
1343  
1344         if (f->f_op && f->f_op->open) {
1345 +               f->f_it = it;
1346                 error = f->f_op->open(inode,f);
1347 +               f->f_it = NULL;
1348                 if (error)
1349                         goto cleanup_all;
1350         }
1351 @@ -693,6 +778,7 @@ struct file *dentry_open(struct dentry *
1352                 do_readahead(f, 0, (48 * 1024) >> PAGE_SHIFT);
1353         
1354  
1355 +       intent_release(it);
1356         return f;
1357  
1358  cleanup_all:
1359 @@ -707,11 +793,17 @@ cleanup_all:
1360  cleanup_file:
1361         put_filp(f);
1362  cleanup_dentry:
1363 +       intent_release(it);
1364         dput(dentry);
1365         mntput(mnt);
1366         return ERR_PTR(error);
1367  }
1368  
1369 +struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1370 +{
1371 +       return dentry_open_it(dentry, mnt, flags, NULL);
1372 +}
1373 +
1374  /*
1375   * Find an empty file descriptor entry, and mark it busy.
1376   */
1377 --- linux-2.4.18-p4smp/fs/stat.c~vfs_intent-2.4.18-18-chaos65   2003-07-09 12:17:30.000000000 -0600
1378 +++ linux-2.4.18-p4smp-braam/fs/stat.c  2003-07-09 13:20:37.000000000 -0600
1379 @@ -17,21 +17,24 @@
1380   * Revalidate the inode. This is required for proper NFS attribute caching.
1381   */
1382  static __inline__ int
1383 -do_revalidate(struct dentry *dentry)
1384 +do_revalidate(struct dentry *dentry, struct lookup_intent *it)
1385  {
1386         struct inode * inode = dentry->d_inode;
1387 -       if (inode->i_op && inode->i_op->revalidate)
1388 +       if (inode->i_op && inode->i_op->revalidate_it)
1389 +               return inode->i_op->revalidate_it(dentry, it);
1390 +       else if (inode->i_op && inode->i_op->revalidate)
1391                 return inode->i_op->revalidate(dentry);
1392         return 0;
1393  }
1394  
1395 -static int do_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
1396 +static int do_getattr(struct vfsmount *mnt, struct dentry *dentry,
1397 +                     struct kstat *stat, struct lookup_intent *it)
1398  {
1399         int res = 0;
1400         unsigned int blocks, indirect;
1401         struct inode *inode = dentry->d_inode;
1402  
1403 -       res = do_revalidate(dentry);
1404 +       res = do_revalidate(dentry, it);
1405         if (res)
1406                 return res;
1407  
1408 @@ -104,10 +107,12 @@ int vfs_stat(char *name, struct kstat *s
1409  {
1410         struct nameidata nd;
1411         int error;
1412 +       struct lookup_intent it = { .it_op = IT_GETATTR };
1413  
1414 -       error = user_path_walk(name, &nd);
1415 +       error = user_path_walk_it(name, &nd, &it);
1416         if (!error) {
1417 -               error = do_getattr(nd.mnt, nd.dentry, stat);
1418 +               error = do_getattr(nd.mnt, nd.dentry, stat, &it);
1419 +               intent_release(&it);
1420                 path_release(&nd);
1421         }
1422         return error;
1423 @@ -117,10 +122,12 @@ int vfs_lstat(char *name, struct kstat *
1424  {
1425         struct nameidata nd;
1426         int error;
1427 +       struct lookup_intent it = { .it_op = IT_GETATTR };
1428  
1429 -       error = user_path_walk_link(name, &nd);
1430 +       error = user_path_walk_link_it(name, &nd, &it);
1431         if (!error) {
1432 -               error = do_getattr(nd.mnt, nd.dentry, stat);
1433 +               error = do_getattr(nd.mnt, nd.dentry, stat, &it);
1434 +               intent_release(&it);
1435                 path_release(&nd);
1436         }
1437         return error;
1438 @@ -132,7 +139,7 @@ int vfs_fstat(unsigned int fd, struct ks
1439         int error = -EBADF;
1440  
1441         if (f) {
1442 -               error = do_getattr(f->f_vfsmnt, f->f_dentry, stat);
1443 +               error = do_getattr(f->f_vfsmnt, f->f_dentry, stat, NULL);
1444                 fput(f);
1445         }
1446         return error;
1447 @@ -279,7 +286,7 @@ asmlinkage long sys_readlink(const char 
1448  
1449                 error = -EINVAL;
1450                 if (inode->i_op && inode->i_op->readlink &&
1451 -                   !(error = do_revalidate(nd.dentry))) {
1452 +                   !(error = do_revalidate(nd.dentry, NULL))) {
1453                         UPDATE_ATIME(inode);
1454                         error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
1455                 }
1456 --- linux-2.4.18-p4smp/fs/proc/base.c~vfs_intent-2.4.18-18-chaos65      2003-07-09 12:20:46.000000000 -0600
1457 +++ linux-2.4.18-p4smp-braam/fs/proc/base.c     2003-07-09 13:20:37.000000000 -0600
1458 @@ -465,6 +465,9 @@ static int proc_pid_follow_link(struct d
1459  
1460         error = inode->u.proc_i.op.proc_get_link(inode, &nd->dentry, &nd->mnt);
1461         nd->last_type = LAST_BIND;
1462 +
1463 +       if (nd->it != NULL)
1464 +               nd->it->it_int_flags |= IT_FL_FOLLOWED;
1465  out:
1466         return error;
1467  }
1468 --- linux-2.4.18-p4smp/include/linux/dcache.h~vfs_intent-2.4.18-18-chaos65      2003-07-09 13:15:23.000000000 -0600
1469 +++ linux-2.4.18-p4smp-braam/include/linux/dcache.h     2003-07-09 13:32:08.000000000 -0600
1470 @@ -6,6 +6,45 @@
1471  #include <asm/atomic.h>
1472  #include <linux/gdb.h>
1473  #include <linux/mount.h>
1474 +#include <linux/string.h>
1475 +
1476 +#define IT_OPEN     0x0001
1477 +#define IT_CREAT    0x0002
1478 +#define IT_READDIR  0x0004
1479 +#define IT_GETATTR  0x0008
1480 +#define IT_LOOKUP   0x0010
1481 +#define IT_UNLINK   0x0020
1482 +#define IT_GETXATTR 0x0040
1483 +#define IT_EXEC     0x0080
1484 +#define IT_PIN      0x0100
1485 +
1486 +#define IT_FL_LOCKED   0x0001
1487 +#define IT_FL_FOLLOWED 0x0002 /* set by vfs_follow_link */
1488 +
1489 +#define INTENT_MAGIC 0x19620323
1490 +
1491 +struct lookup_intent {
1492 +       int it_op;
1493 +       void (*it_op_release)(struct lookup_intent *);
1494 +       int it_magic;
1495 +       int it_mode;
1496 +       int it_flags;
1497 +       int it_disposition;
1498 +       int it_status;
1499 +       int it_int_flags;
1500 +       __u64 it_lock_handle[2];
1501 +       int it_lock_mode;
1502 +       void *it_data;
1503 +};
1504 +
1505 +static inline void intent_init(struct lookup_intent *it, int op, int flags)
1506 +{
1507 +       memset(it, 0, sizeof(*it));
1508 +       it->it_magic = INTENT_MAGIC;
1509 +       it->it_op = op;
1510 +       it->it_flags = flags;
1511 +}
1512 +
1513  
1514  /*
1515   * linux/include/linux/dcache.h
1516 @@ -92,8 +131,22 @@ struct dentry_operations {
1517         int (*d_delete)(struct dentry *);
1518         void (*d_release)(struct dentry *);
1519         void (*d_iput)(struct dentry *, struct inode *);
1520 +       int (*d_revalidate_it)(struct dentry *, int, struct lookup_intent *);
1521 +       void (*d_pin)(struct dentry *, struct vfsmount * , int);
1522 +       void (*d_unpin)(struct dentry *, struct vfsmount *, int);
1523  };
1524  
1525 +#define PIN(de,mnt,flag)  if (de->d_op && de->d_op->d_pin) \
1526 +                               de->d_op->d_pin(de, mnt, flag);
1527 +#define UNPIN(de,mnt,flag)  if (de->d_op && de->d_op->d_unpin) \
1528 +                               de->d_op->d_unpin(de, mnt, flag);
1529 +
1530 +
1531 +/* defined in fs/namei.c */
1532 +extern void intent_release(struct lookup_intent *it);
1533 +/* defined in fs/dcache.c */
1534 +extern void __d_rehash(struct dentry * entry, int lock);
1535 +
1536  /* the dentry parameter passed to d_hash and d_compare is the parent
1537   * directory of the entries to be compared. It is used in case these
1538   * functions need any directory specific information for determining
1539 @@ -125,6 +178,7 @@ d_iput:             no              no              yes
1540                                          * s_nfsd_free_path semaphore will be down
1541                                          */
1542  #define DCACHE_REFERENCED      0x0008  /* Recently used, don't discard. */
1543 +#define DCACHE_LUSTRE_INVALID  0x0010  /* Lustre invalidated */
1544  
1545  extern spinlock_t dcache_lock;
1546  
1547 --- linux-2.4.18-p4smp/include/linux/fs.h~vfs_intent-2.4.18-18-chaos65  2003-07-08 14:41:47.000000000 -0600
1548 +++ linux-2.4.18-p4smp-braam/include/linux/fs.h 2003-07-08 14:45:17.000000000 -0600
1549 @@ -339,6 +339,9 @@ extern void set_bh_page(struct buffer_he
1550  #define ATTR_MTIME_SET 256
1551  #define ATTR_FORCE     512     /* Not a change, but a change it */
1552  #define ATTR_ATTR_FLAG 1024
1553 +#define ATTR_RAW       0x0800  /* file system, not vfs will massage attrs */
1554 +#define ATTR_FROM_OPEN 0x1000  /* called from open path, ie O_TRUNC */
1555 +#define ATTR_CTIME_SET 0x2000  /* called from open path, ie O_TRUNC */
1556  
1557  /*
1558   * This is the Inode Attributes structure, used for notify_change().  It
1559 @@ -578,6 +580,7 @@ struct file {
1560  
1561         /* needed for tty driver, and maybe others */
1562         void                    *private_data;
1563 +       struct lookup_intent    *f_it;
1564  
1565         /* preallocated helper kiobuf to speedup O_DIRECT */
1566         struct kiobuf           *f_iobuf;
1567 @@ -707,6 +710,7 @@ struct nameidata {
1568         struct qstr last;
1569         unsigned int flags;
1570         int last_type;
1571 +       struct lookup_intent *it;
1572  };
1573  
1574  #define DQUOT_USR_ENABLED      0x01            /* User diskquotas enabled */
1575 @@ -840,7 +844,8 @@ extern int vfs_symlink(struct inode *, s
1576  extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1577  extern int vfs_rmdir(struct inode *, struct dentry *);
1578  extern int vfs_unlink(struct inode *, struct dentry *);
1579 -extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
1580 +int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1581 +              struct inode *new_dir, struct dentry *new_dentry);
1582  
1583  /*
1584   * File types
1585 @@ -900,21 +905,34 @@ struct file_operations {
1586  
1587  struct inode_operations {
1588         int (*create) (struct inode *,struct dentry *,int);
1589 +       int (*create_it) (struct inode *,struct dentry *,int, struct lookup_intent *);
1590         struct dentry * (*lookup) (struct inode *,struct dentry *);
1591 +       struct dentry * (*lookup_it) (struct inode *,struct dentry *, struct lookup_intent *, int flags);
1592         int (*link) (struct dentry *,struct inode *,struct dentry *);
1593 +       int (*link_raw) (struct nameidata *,struct nameidata *);
1594         int (*unlink) (struct inode *,struct dentry *);
1595 +       int (*unlink_raw) (struct nameidata *);
1596         int (*symlink) (struct inode *,struct dentry *,const char *);
1597 +       int (*symlink_raw) (struct nameidata *,const char *);
1598         int (*mkdir) (struct inode *,struct dentry *,int);
1599 +       int (*mkdir_raw) (struct nameidata *,int);
1600         int (*rmdir) (struct inode *,struct dentry *);
1601 +       int (*rmdir_raw) (struct nameidata *);
1602         int (*mknod) (struct inode *,struct dentry *,int,int);
1603 +       int (*mknod_raw) (struct nameidata *,int,dev_t);
1604         int (*rename) (struct inode *, struct dentry *,
1605                         struct inode *, struct dentry *);
1606 +       int (*rename_raw) (struct nameidata *, struct nameidata *);
1607         int (*readlink) (struct dentry *, char *,int);
1608         int (*follow_link) (struct dentry *, struct nameidata *);
1609 +       int (*follow_link2) (struct dentry *, struct nameidata *,
1610 +                            struct lookup_intent *it);
1611         void (*truncate) (struct inode *);
1612         int (*permission) (struct inode *, int);
1613         int (*revalidate) (struct dentry *);
1614 +       int (*revalidate_it) (struct dentry *, struct lookup_intent *);
1615         int (*setattr) (struct dentry *, struct iattr *);
1616 +       int (*setattr_raw) (struct inode *, struct iattr *);
1617         int (*getattr) (struct dentry *, struct iattr *);
1618  };
1619  
1620 @@ -1119,10 +1137,12 @@ static inline int get_lease(struct inode
1621  
1622  asmlinkage long sys_open(const char *, int, int);
1623  asmlinkage long sys_close(unsigned int);       /* yes, it's really unsigned */
1624 -extern int do_truncate(struct dentry *, loff_t start);
1625 +extern int do_truncate(struct dentry *, loff_t start, int called_from_open);
1626  
1627  extern struct file *filp_open(const char *, int, int);
1628  extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
1629 +extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1630 +                           int flags, struct lookup_intent *it);
1631  extern int filp_close(struct file *, fl_owner_t id);
1632  extern char * getname(const char *);
1633  
1634 @@ -1388,9 +1408,12 @@ typedef int (*read_actor_t)(read_descrip
1635  extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
1636  
1637  extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
1638 +extern int FASTCALL(__user_walk_it(const char *, unsigned, struct nameidata *, struct lookup_intent *it));
1639  extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
1640  extern int FASTCALL(path_walk(const char *, struct nameidata *));
1641  extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
1642 +extern int FASTCALL(path_lookup_it(const char *path, unsigned flags, struct nameidata *nd,
1643 +                  struct lookup_intent *it));
1644  extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
1645  extern void path_release(struct nameidata *);
1646  extern int follow_down(struct vfsmount **, struct dentry **);
1647 @@ -1399,6 +1422,8 @@ extern struct dentry * lookup_one_len(co
1648  extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
1649  #define user_path_walk(name,nd)         __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
1650  #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
1651 +#define user_path_walk_it(name,nd,it)  __user_walk_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd, it)
1652 +#define user_path_walk_link_it(name,nd,it) __user_walk_it(name, LOOKUP_POSITIVE, nd, it)
1653  
1654  extern void inode_init_once(struct inode *);
1655  extern void iput(struct inode *);
1656 @@ -1499,6 +1524,8 @@ extern struct file_operations generic_ro
1657  
1658  extern int vfs_readlink(struct dentry *, char *, int, const char *);
1659  extern int vfs_follow_link(struct nameidata *, const char *);
1660 +extern int vfs_follow_link_it(struct nameidata *, const char *,
1661 +                             struct lookup_intent *it);
1662  extern int page_readlink(struct dentry *, char *, int);
1663  extern int page_follow_link(struct dentry *, struct nameidata *);
1664  extern struct inode_operations page_symlink_inode_operations;
1665 --- linux-2.4.18-p4smp/kernel/fork.c~vfs_intent-2.4.18-18-chaos65       2003-03-24 11:22:37.000000000 -0700
1666 +++ linux-2.4.18-p4smp-braam/kernel/fork.c      2003-07-09 13:20:37.000000000 -0600
1667 @@ -399,10 +399,13 @@ static inline struct fs_struct *__copy_f
1668                 fs->umask = old->umask;
1669                 read_lock(&old->lock);
1670                 fs->rootmnt = mntget(old->rootmnt);
1671 +               PIN(old->pwd, old->pwdmnt, 0);
1672 +               PIN(old->root, old->rootmnt, 1);
1673                 fs->root = dget(old->root);
1674                 fs->pwdmnt = mntget(old->pwdmnt);
1675                 fs->pwd = dget(old->pwd);
1676                 if (old->altroot) {
1677 +                       PIN(old->altroot, old->altrootmnt, 1);
1678                         fs->altrootmnt = mntget(old->altrootmnt);
1679                         fs->altroot = dget(old->altroot);
1680                 } else {
1681 --- linux-2.4.18-p4smp/kernel/exit.c~vfs_intent-2.4.18-18-chaos65       2002-10-29 12:27:38.000000000 -0700
1682 +++ linux-2.4.18-p4smp-braam/kernel/exit.c      2003-07-09 13:20:37.000000000 -0600
1683 @@ -303,11 +303,14 @@ static inline void __put_fs_struct(struc
1684  {
1685         /* No need to hold fs->lock if we are killing it */
1686         if (atomic_dec_and_test(&fs->count)) {
1687 +               UNPIN(fs->pwd, fs->pwdmnt, 0);
1688 +               UNPIN(fs->root, fs->rootmnt, 1);
1689                 dput(fs->root);
1690                 mntput(fs->rootmnt);
1691                 dput(fs->pwd);
1692                 mntput(fs->pwdmnt);
1693                 if (fs->altroot) {
1694 +                       UNPIN(fs->altroot, fs->altrootmnt, 1);
1695                         dput(fs->altroot);
1696                         mntput(fs->altrootmnt);
1697                 }
1698 --- linux-2.4.18-p4smp/kernel/ksyms.c~vfs_intent-2.4.18-18-chaos65      2003-07-09 13:20:35.000000000 -0600
1699 +++ linux-2.4.18-p4smp-braam/kernel/ksyms.c     2003-07-09 13:20:37.000000000 -0600
1700 @@ -294,6 +294,7 @@ EXPORT_SYMBOL(read_cache_page);
1701  EXPORT_SYMBOL(set_page_dirty);
1702  EXPORT_SYMBOL(vfs_readlink);
1703  EXPORT_SYMBOL(vfs_follow_link);
1704 +EXPORT_SYMBOL(vfs_follow_link_it);
1705  EXPORT_SYMBOL(page_readlink);
1706  EXPORT_SYMBOL(page_follow_link);
1707  EXPORT_SYMBOL(page_symlink_inode_operations);
1708
1709 _