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