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