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