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