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