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