Whamcloud - gitweb
- put the exit(1)s back in after MPI_Abort() in the hopes that MPI
[fs/lustre-release.git] / lustre / kernel_patches / patches / vfs_intent-2.6-suse.patch
1 Index: linux-2.6.3-20/fs/exec.c
2 ===================================================================
3 --- linux-2.6.3-20.orig/fs/exec.c       2004-03-05 02:07:04.000000000 -0800
4 +++ linux-2.6.3-20/fs/exec.c    2004-03-08 14:23:40.000000000 -0800
5 @@ -121,8 +121,11 @@
6         struct file * file;
7         struct nameidata nd;
8         int error;
9 +       intent_init(&nd.intent, IT_OPEN);
10  
11 -       nd.intent.open.flags = FMODE_READ;
12 +       error = user_path_walk_it(library, &nd);
13 +
14 +       nd.intent.it_flags = O_RDONLY;
15         error = __user_walk(library, LOOKUP_FOLLOW|LOOKUP_OPEN, &nd);
16         if (error)
17                 goto out;
18 @@ -135,7 +138,7 @@
19         if (error)
20                 goto exit;
21  
22 -       file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
23 +       file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &nd.intent);
24         error = PTR_ERR(file);
25         if (IS_ERR(file))
26                 goto out;
27 @@ -475,8 +478,9 @@
28         int err;
29         struct file *file;
30  
31 -       nd.intent.open.flags = FMODE_READ;
32 -       err = path_lookup(name, LOOKUP_FOLLOW|LOOKUP_OPEN, &nd);
33 +       intent_init(&nd.intent, IT_OPEN);
34 +       nd.intent.it_flags = O_RDONLY;
35 +       err = path_lookup(name, LOOKUP_FOLLOW, &nd);
36         file = ERR_PTR(err);
37  
38         if (!err) {
39 @@ -489,7 +493,7 @@
40                                 err = -EACCES;
41                         file = ERR_PTR(err);
42                         if (!err) {
43 -                               file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
44 +                               file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &nd.intent);
45                                 if (!IS_ERR(file)) {
46                                         err = deny_write_access(file);
47                                         if (err) {
48 Index: linux-2.6.3-20/fs/namei.c
49 ===================================================================
50 --- linux-2.6.3-20.orig/fs/namei.c      2004-03-05 02:07:04.000000000 -0800
51 +++ linux-2.6.3-20/fs/namei.c   2004-03-08 14:32:24.000000000 -0800
52 @@ -269,8 +269,19 @@
53         return 0;
54  }
55  
56 +void intent_release(struct lookup_intent *it)
57 +{
58 +       if (!it)
59 +               return;
60 +       if (it->it_magic != INTENT_MAGIC)
61 +               return;
62 +       if (it->it_op_release)
63 +               it->it_op_release(it);
64 +}
65 +
66  void path_release(struct nameidata *nd)
67  {
68 +       intent_release(&nd->intent);
69         dput(nd->dentry);
70         mntput(nd->mnt);
71  }
72 @@ -347,7 +358,10 @@
73  {
74         struct dentry * result;
75         struct inode *dir = parent->d_inode;
76 +       int counter = 0;
77  
78 +again:
79 +       counter++;
80         down(&dir->i_sem);
81         /*
82          * First re-do the cached lookup just in case it was created
83 @@ -386,7 +400,10 @@
84         if (result->d_op && result->d_op->d_revalidate) {
85                 if (!result->d_op->d_revalidate(result, nd) && !d_invalidate(result)) {
86                         dput(result);
87 -                       result = ERR_PTR(-ENOENT);
88 +                       if (counter > 10)
89 +                               result = ERR_PTR(-ESTALE);
90 +                       if (!IS_ERR(result))
91 +                               goto again;
92                 }
93         }
94         return result;
95 @@ -563,6 +580,31 @@
96         return PTR_ERR(dentry);
97  }
98  
99 +static int revalidate_special(struct nameidata *nd)
100 +{
101 +       struct dentry *dentry = nd->dentry;
102 +       int err, counter = 0;
103 +
104 +       if (!dentry->d_op || !dentry->d_op->d_revalidate)
105 +               return 0;
106 + revalidate_again:
107 +       if (!dentry->d_op->d_revalidate(dentry, nd)) {
108 +               struct dentry *new;
109 +               if ((err = permission(dentry->d_parent->d_inode, MAY_EXEC,nd)))
110 +                       return err;
111 +               new = real_lookup(dentry->d_parent, &dentry->d_name, nd);
112 +               d_invalidate(dentry);
113 +               dput(dentry);
114 +               nd->dentry = dentry = new;
115 +               counter++;
116 +               if (counter < 10)
117 +                       goto revalidate_again;
118 +               printk("excessive revalidate_it loops\n");
119 +               return -ESTALE;
120 +       }
121 +       return 0;
122 +}
123 +
124  /*
125   * Name resolution.
126   *
127 @@ -663,7 +705,9 @@
128  
129                 if (inode->i_op->follow_link) {
130                         mntget(next.mnt);
131 +                       nd->flags |= LOOKUP_LINK_NOTLAST;
132                         err = do_follow_link(next.dentry, nd);
133 +                       nd->flags &= ~LOOKUP_LINK_NOTLAST;
134                         dput(next.dentry);
135                         mntput(next.mnt);
136                         if (err)
137 @@ -702,6 +746,11 @@
138                                 inode = nd->dentry->d_inode;
139                                 /* fallthrough */
140                         case 1:
141 +                               nd->flags |= LOOKUP_LAST;
142 +                               err = revalidate_special(nd);
143 +                               nd->flags &= ~LOOKUP_LAST;
144 +                               if (err)
145 +                                       break;
146                                 goto return_reval;
147                 }
148                 if (nd->dentry->d_op && nd->dentry->d_op->d_hash) {
149 @@ -709,7 +758,9 @@
150                         if (err < 0)
151                                 break;
152                 }
153 +               nd->flags |= LOOKUP_LAST;
154                 err = do_lookup(nd, &this, &next);
155 +               nd->flags &= ~LOOKUP_LAST;
156                 if (err)
157                         break;
158                 follow_mount(&next.mnt, &next.dentry);
159 @@ -935,7 +986,7 @@
160  }
161  
162  /* SMP-safe */
163 -struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
164 +struct dentry * lookup_one_len_it(const char * name, struct dentry * base, int len, struct nameidata *nd)
165  {
166         unsigned long hash;
167         struct qstr this;
168 @@ -955,11 +1006,16 @@
169         }
170         this.hash = end_name_hash(hash);
171  
172 -       return lookup_hash(&this, base);
173 +       return __lookup_hash(&this, base, nd);
174  access:
175         return ERR_PTR(-EACCES);
176  }
177  
178 +struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
179 +{
180 +       return lookup_one_len_it(name, base, len, NULL);
181 +}
182 +
183  /*
184   *     namei()
185   *
186 @@ -971,7 +1027,7 @@
187   * that namei follows links, while lnamei does not.
188   * SMP-safe
189   */
190 -int fastcall __user_walk(const char __user *name, unsigned flags, struct nameidata *nd)
191 +int fastcall __user_walk_it(const char __user *name, unsigned flags, struct nameidata *nd)
192  {
193         char *tmp = getname(name);
194         int err = PTR_ERR(tmp);
195 @@ -983,6 +1039,12 @@
196         return err;
197  }
198  
199 +int __user_walk(const char __user *name, unsigned flags, struct nameidata *nd)
200 +{
201 +       intent_init(&nd->intent, IT_LOOKUP);
202 +       return __user_walk_it(name, flags, nd);
203 +}
204 +
205  /*
206   * It's inline, so penalty for filesystems that don't use sticky bit is
207   * minimal.
208 @@ -1255,8 +1317,8 @@
209                 acc_mode |= MAY_APPEND;
210  
211         /* Fill in the open() intent data */
212 -       nd->intent.open.flags = flag;
213 -       nd->intent.open.create_mode = mode;
214 +       nd->intent.it_flags = flag;
215 +       nd->intent.it_create_mode = mode;
216  
217         /*
218          * The simplest case - just a plain lookup.
219 @@ -1271,6 +1333,7 @@
220         /*
221          * Create - we need to know the parent.
222          */
223 +       nd->intent.it_op |= IT_CREAT;
224         error = path_lookup(pathname, LOOKUP_PARENT|LOOKUP_OPEN|LOOKUP_CREATE, nd);
225         if (error)
226                 return error;
227 @@ -1287,7 +1350,9 @@
228         dir = nd->dentry;
229         nd->flags &= ~LOOKUP_PARENT;
230         down(&dir->d_inode->i_sem);
231 +       nd->flags |= LOOKUP_LAST;
232         dentry = __lookup_hash(&nd->last, nd->dentry, nd);
233 +       nd->flags &= ~LOOKUP_LAST;
234  
235  do_last:
236         error = PTR_ERR(dentry);
237 @@ -1392,7 +1457,9 @@
238         }
239         dir = nd->dentry;
240         down(&dir->d_inode->i_sem);
241 +       nd->flags |= LOOKUP_LAST;
242         dentry = __lookup_hash(&nd->last, nd->dentry, nd);
243 +       nd->flags &= ~LOOKUP_LAST;
244         putname(nd->last.name);
245         goto do_last;
246  }
247 @@ -2154,7 +2221,9 @@
248  __vfs_follow_link(struct nameidata *nd, const char *link)
249  {
250         int res = 0;
251 +       struct lookup_intent it = nd->intent;
252         char *name;
253 +
254         if (IS_ERR(link))
255                 goto fail;
256  
257 @@ -2164,6 +2233,10 @@
258                         /* weird __emul_prefix() stuff did it */
259                         goto out;
260         }
261 +
262 +       intent_init(&nd->intent, it.it_op);
263 +       nd->intent.it_flags = it.it_flags;
264 +       nd->intent.it_create_mode = it.it_create_mode;
265         res = link_path_walk(link, nd);
266  out:
267         if (current->link_count || res || nd->last_type!=LAST_NORM)
268 Index: linux-2.6.3-20/fs/namespace.c
269 ===================================================================
270 --- linux-2.6.3-20.orig/fs/namespace.c  2004-03-05 02:07:04.000000000 -0800
271 +++ linux-2.6.3-20/fs/namespace.c       2004-03-08 14:23:40.000000000 -0800
272 @@ -744,6 +744,7 @@
273         int retval = 0;
274         int mnt_flags = 0;
275  
276 +       intent_init(&nd.intent, IT_LOOKUP);
277         /* Discard magic */
278         if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
279                 flags &= ~MS_MGC_MSK;
280 Index: linux-2.6.3-20/fs/open.c
281 ===================================================================
282 --- linux-2.6.3-20.orig/fs/open.c       2004-03-05 02:07:04.000000000 -0800
283 +++ linux-2.6.3-20/fs/open.c    2004-03-08 14:23:40.000000000 -0800
284 @@ -202,7 +202,7 @@
285         struct nameidata nd;
286         struct inode * inode;
287         int error;
288 -
289 +       intent_init(&nd.intent, IT_GETATTR);
290         error = -EINVAL;
291         if (length < 0) /* sorry, but loff_t says... */
292                 goto out;
293 @@ -461,6 +461,7 @@
294         int old_fsuid, old_fsgid;
295         kernel_cap_t old_cap;
296         int res;
297 +       intent_init(&nd.intent, IT_GETATTR);
298  
299         if (mode & ~S_IRWXO)    /* where's F_OK, X_OK, W_OK, R_OK? */
300                 return -EINVAL;
301 @@ -492,6 +493,7 @@
302                 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
303                    && !special_file(nd.dentry->d_inode->i_mode))
304                         res = -EROFS;
305 +
306                 path_release(&nd);
307         }
308  
309 @@ -506,6 +508,7 @@
310  {
311         struct nameidata nd;
312         int error;
313 +       intent_init(&nd.intent, IT_GETATTR);
314  
315         error = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &nd);
316         if (error)
317 @@ -557,6 +560,7 @@
318  {
319         struct nameidata nd;
320         int error;
321 +       intent_init(&nd.intent, IT_GETATTR);
322  
323         error = __user_walk(filename, LOOKUP_FOLLOW | LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
324         if (error)
325 @@ -629,7 +633,7 @@
326         error = -EROFS;
327         if (IS_RDONLY(inode))
328                 goto dput_and_out;
329 -
330 +       
331         error = -EPERM;
332         if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
333                 goto dput_and_out;
334 @@ -737,27 +741,8 @@
335   * for the internal routines (ie open_namei()/follow_link() etc). 00 is
336   * used by symlinks.
337   */
338 -struct file *filp_open(const char * filename, int flags, int mode)
339 -{
340 -       int namei_flags, error;
341 -       struct nameidata nd;
342 -
343 -       namei_flags = flags;
344 -       if ((namei_flags+1) & O_ACCMODE)
345 -               namei_flags++;
346 -       if (namei_flags & O_TRUNC)
347 -               namei_flags |= 2;
348 -
349 -       error = open_namei(filename, namei_flags, mode, &nd);
350 -       if (!error)
351 -               return dentry_open(nd.dentry, nd.mnt, flags);
352 -
353 -       return ERR_PTR(error);
354 -}
355 -
356 -EXPORT_SYMBOL(filp_open);
357 -
358 -struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
359 +struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt, int flags,
360 +                           struct lookup_intent *it)
361  {
362         struct file * f;
363         struct inode *inode;
364 @@ -769,6 +754,7 @@
365                 goto cleanup_dentry;
366         f->f_flags = flags;
367         f->f_mode = (flags+1) & O_ACCMODE;
368 +       f->f_it = it;
369         inode = dentry->d_inode;
370         if (f->f_mode & FMODE_WRITE) {
371                 error = get_write_access(inode);
372 @@ -788,6 +774,7 @@
373                 error = f->f_op->open(inode,f);
374                 if (error)
375                         goto cleanup_all;
376 +               intent_release(it);
377         }
378         f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
379  
380 @@ -812,6 +799,7 @@
381  cleanup_file:
382         put_filp(f);
383  cleanup_dentry:
384 +       intent_release(it);
385         dput(dentry);
386         mntput(mnt);
387         return ERR_PTR(error);
388 @@ -819,6 +807,36 @@
389  
390  EXPORT_SYMBOL(dentry_open);
391  
392 +struct file *filp_open(const char * filename, int flags, int mode)
393 +{
394 +       int namei_flags, error;
395 +       struct file * temp_filp;
396 +       struct nameidata nd;
397 +       intent_init(&nd.intent, IT_OPEN);
398 +
399 +       namei_flags = flags;
400 +       if ((namei_flags+1) & O_ACCMODE)
401 +               namei_flags++;
402 +       if (namei_flags & O_TRUNC)
403 +               namei_flags |= 2;
404 +
405 +       error = open_namei(filename, namei_flags, mode, &nd);
406 +       if (!error) {
407 +               temp_filp = dentry_open_it(nd.dentry, nd.mnt, flags, &nd.intent);
408 +               return temp_filp;
409 +       }       
410 +       return ERR_PTR(error);
411 +}
412 +
413 +
414 +struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
415 +{
416 +       struct lookup_intent it;
417 +       intent_init(&it, IT_LOOKUP);
418 +
419 +       return dentry_open_it(dentry, mnt, flags, &it);
420 +}
421 +
422  /*
423   * Find an empty file descriptor entry, and mark it busy.
424   */
425 Index: linux-2.6.3-20/fs/stat.c
426 ===================================================================
427 --- linux-2.6.3-20.orig/fs/stat.c       2004-03-05 02:07:04.000000000 -0800
428 +++ linux-2.6.3-20/fs/stat.c    2004-03-08 14:23:40.000000000 -0800
429 @@ -36,7 +36,7 @@
430  
431  EXPORT_SYMBOL(generic_fillattr);
432  
433 -int vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
434 +int vfs_getattr_it(struct vfsmount *mnt, struct dentry *dentry, struct lookup_intent *it, struct kstat *stat)
435  {
436         struct inode *inode = dentry->d_inode;
437         int retval;
438 @@ -45,6 +45,8 @@
439         if (retval)
440                 return retval;
441  
442 +       if (inode->i_op->getattr_it)
443 +               return inode->i_op->getattr_it(mnt, dentry, it, stat);
444         if (inode->i_op->getattr)
445                 return inode->i_op->getattr(mnt, dentry, stat);
446  
447 @@ -61,14 +63,20 @@
448  
449  EXPORT_SYMBOL(vfs_getattr);
450  
451 +int vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
452 +{
453 +       return vfs_getattr_it(mnt, dentry, NULL, stat);
454 +}
455 +
456  int vfs_stat(char __user *name, struct kstat *stat)
457  {
458         struct nameidata nd;
459         int error;
460 +       intent_init(&nd.intent, IT_GETATTR);
461  
462 -       error = user_path_walk(name, &nd);
463 +       error = user_path_walk_it(name, &nd);
464         if (!error) {
465 -               error = vfs_getattr(nd.mnt, nd.dentry, stat);
466 +               error = vfs_getattr_it(nd.mnt, nd.dentry, &nd.intent, stat);
467                 path_release(&nd);
468         }
469         return error;
470 @@ -80,10 +88,11 @@
471  {
472         struct nameidata nd;
473         int error;
474 +       intent_init(&nd.intent, IT_GETATTR);
475  
476 -       error = user_path_walk_link(name, &nd);
477 +       error = user_path_walk_link_it(name, &nd);
478         if (!error) {
479 -               error = vfs_getattr(nd.mnt, nd.dentry, stat);
480 +               error = vfs_getattr_it(nd.mnt, nd.dentry, &nd.intent, stat);
481                 path_release(&nd);
482         }
483         return error;
484 @@ -95,9 +104,12 @@
485  {
486         struct file *f = fget(fd);
487         int error = -EBADF;
488 +       struct nameidata nd;
489 +       intent_init(&nd.intent, IT_GETATTR);
490  
491         if (f) {
492 -               error = vfs_getattr(f->f_vfsmnt, f->f_dentry, stat);
493 +               error = vfs_getattr_it(f->f_vfsmnt, f->f_dentry, &nd.intent, stat);
494 +               intent_release(&nd.intent);
495                 fput(f);
496         }
497         return error;
498 Index: linux-2.6.3-20/fs/nfs/dir.c
499 ===================================================================
500 --- linux-2.6.3-20.orig/fs/nfs/dir.c    2004-03-05 02:07:03.000000000 -0800
501 +++ linux-2.6.3-20/fs/nfs/dir.c 2004-03-08 14:23:40.000000000 -0800
502 @@ -681,7 +681,7 @@
503                 return 0;
504         if (!nd || (nd->flags & LOOKUP_CONTINUE) || !(nd->flags & LOOKUP_CREATE))
505                 return 0;
506 -       return (nd->intent.open.flags & O_EXCL) != 0;
507 +       return (nd->intent.it_flags & O_EXCL) != 0;
508  }
509  
510  static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
511 @@ -972,7 +972,7 @@
512         attr.ia_valid = ATTR_MODE;
513  
514         if (nd && (nd->flags & LOOKUP_CREATE))
515 -               open_flags = nd->intent.open.flags;
516 +               open_flags = nd->intent.it_flags;
517  
518         /*
519          * The 0 argument passed into the create function should one day
520 Index: linux-2.6.3-20/fs/inode.c
521 ===================================================================
522 --- linux-2.6.3-20.orig/fs/inode.c      2004-03-05 02:07:04.000000000 -0800
523 +++ linux-2.6.3-20/fs/inode.c   2004-03-08 14:23:40.000000000 -0800
524 @@ -223,6 +223,7 @@
525         inodes_stat.nr_unused--;
526  }
527  
528 +EXPORT_SYMBOL(__iget);
529  /**
530   * clear_inode - clear an inode
531   * @inode: inode to clear
532 Index: linux-2.6.3-20/fs/super.c
533 ===================================================================
534 --- linux-2.6.3-20.orig/fs/super.c      2004-03-05 02:07:04.000000000 -0800
535 +++ linux-2.6.3-20/fs/super.c   2004-03-08 14:23:40.000000000 -0800
536 @@ -841,6 +841,8 @@
537         return (struct vfsmount *)sb;
538  }
539  
540 +EXPORT_SYMBOL(do_kern_mount);
541 +
542  struct vfsmount *kern_mount(struct file_system_type *type)
543  {
544         return do_kern_mount(type->name, 0, type->name, NULL);
545 Index: linux-2.6.3-20/include/linux/dcache.h
546 ===================================================================
547 --- linux-2.6.3-20.orig/include/linux/dcache.h  2004-03-05 02:07:17.000000000 -0800
548 +++ linux-2.6.3-20/include/linux/dcache.h       2004-03-08 14:23:40.000000000 -0800
549 @@ -4,6 +4,7 @@
550  #ifdef __KERNEL__
551  
552  #include <asm/atomic.h>
553 +#include <linux/string.h>
554  #include <linux/list.h>
555  #include <linux/spinlock.h>
556  #include <linux/cache.h>
557 @@ -35,6 +36,8 @@
558         char name_str[0];
559  };
560  
561 +#include <linux/namei.h>
562 +
563  struct dentry_stat_t {
564         int nr_dentry;
565         int nr_unused;
566 Index: linux-2.6.3-20/include/linux/fs.h
567 ===================================================================
568 --- linux-2.6.3-20.orig/include/linux/fs.h      2004-03-05 02:07:17.000000000 -0800
569 +++ linux-2.6.3-20/include/linux/fs.h   2004-03-08 14:23:41.000000000 -0800
570 @@ -243,6 +243,8 @@
571  #define ATTR_ATTR_FLAG 1024
572  #define ATTR_KILL_SUID 2048
573  #define ATTR_KILL_SGID 4096
574 +#define ATTR_RAW               8192    /* file system, not vfs will massage attrs */
575 +#define ATTR_FROM_OPEN         16384    /* called from open path, ie O_TRUNC */
576  
577  /*
578   * This is the Inode Attributes structure, used for notify_change().  It
579 @@ -409,6 +411,7 @@
580         struct block_device     *i_bdev;
581         struct cdev             *i_cdev;
582         int                     i_cindex;
583 +       void                    *i_filterdata;
584  
585         unsigned long           i_dnotify_mask; /* Directory notify events */
586         struct dnotify_struct   *i_dnotify; /* for directory notifications */
587 @@ -541,6 +544,7 @@
588         spinlock_t              f_ep_lock;
589  #endif /* #ifdef CONFIG_EPOLL */
590         struct address_space    *f_mapping;
591 +       struct lookup_intent    *f_it;
592  };
593  extern spinlock_t files_lock;
594  #define file_list_lock() spin_lock(&files_lock);
595 @@ -846,7 +850,9 @@
596         void (*truncate) (struct inode *);
597         int (*permission) (struct inode *, int, struct nameidata *);
598         int (*setattr) (struct dentry *, struct iattr *);
599 +       int (*setattr_raw) (struct inode *, struct iattr *);
600         int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
601 +       int (*getattr_it) (struct vfsmount *, struct dentry *, struct lookup_intent *, struct kstat *);
602         int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
603         ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
604         ssize_t (*listxattr) (struct dentry *, char *, size_t);
605 @@ -1062,6 +1068,7 @@
606  extern int unregister_filesystem(struct file_system_type *);
607  extern struct vfsmount *kern_mount(struct file_system_type *);
608  extern int may_umount(struct vfsmount *);
609 +struct vfsmount *do_kern_mount(const char *type, int flags, const char *name, void *data);
610  extern long do_mount(char *, char *, char *, unsigned long, void *);
611  
612  extern int vfs_statfs(struct super_block *, struct kstatfs *);
613 @@ -1126,6 +1133,7 @@
614  extern int do_truncate(struct dentry *, loff_t start);
615  extern struct file *filp_open(const char *, int, int);
616  extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
617 +extern struct file * dentry_open_it(struct dentry *, struct vfsmount *, int, struct lookup_intent *);
618  extern int filp_close(struct file *, fl_owner_t id);
619  extern char * getname(const char __user *);
620  
621 Index: linux-2.6.3-20/include/linux/namei.h
622 ===================================================================
623 --- linux-2.6.3-20.orig/include/linux/namei.h   2004-03-05 02:07:18.000000000 -0800
624 +++ linux-2.6.3-20/include/linux/namei.h        2004-03-08 14:23:41.000000000 -0800
625 @@ -2,25 +2,55 @@
626  #define _LINUX_NAMEI_H
627  
628  #include <linux/linkage.h>
629 +#include <linux/string.h>
630  
631  struct vfsmount;
632 +struct nameidata;
633  
634 -struct open_intent {
635 -       int     flags;
636 -       int     create_mode;
637 +/* intent opcodes */
638 +#define IT_OPEN     (1)
639 +#define IT_CREAT    (1<<1)
640 +#define IT_READDIR  (1<<2)
641 +#define IT_GETATTR  (1<<3)
642 +#define IT_LOOKUP   (1<<4)
643 +#define IT_UNLINK   (1<<5)
644 +#define IT_TRUNC    (1<<6)
645 +#define IT_GETXATTR (1<<7)
646 +
647 +struct lustre_intent_data {
648 +       int       it_disposition;
649 +       int       it_status;
650 +       __u64     it_lock_handle;
651 +       void     *it_data;
652 +       int       it_lock_mode;
653  };
654  
655 +#define INTENT_MAGIC 0x19620323
656 +struct lookup_intent {
657 +       int     it_magic;
658 +       void    (*it_op_release)(struct lookup_intent *);
659 +       int     it_op;
660 +       int     it_flags;
661 +       int     it_create_mode;
662 +       union {
663 +               struct lustre_intent_data lustre;
664 +       } d;
665 +};
666 +
667 +static inline void intent_init(struct lookup_intent *it, int op)
668 +{
669 +       memset(it, 0, sizeof(*it));
670 +       it->it_magic = INTENT_MAGIC;
671 +       it->it_op = op;
672 +}
673 +
674  struct nameidata {
675         struct dentry   *dentry;
676         struct vfsmount *mnt;
677         struct qstr     last;
678         unsigned int    flags;
679         int             last_type;
680 -
681 -       /* Intent data */
682 -       union {
683 -               struct open_intent open;
684 -       } intent;
685 +       struct lookup_intent intent;
686  };
687  
688  /*
689 @@ -41,6 +71,9 @@
690  #define LOOKUP_CONTINUE                 4
691  #define LOOKUP_PARENT          16
692  #define LOOKUP_NOALT           32
693 +#define LOOKUP_LAST             (1<<6)
694 +#define LOOKUP_LINK_NOTLAST     (1<<7)
695 +
696  /*
697   * Intent data
698   */
699 @@ -49,6 +82,12 @@
700  #define LOOKUP_ACCESS          (0x0400)
701  
702  extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *));
703 +extern int FASTCALL(__user_walk_it(const char __user *name, unsigned flags, struct nameidata *nd));
704 +#define user_path_walk_it(name,nd) \
705 +       __user_walk_it(name, LOOKUP_FOLLOW, nd)
706 +#define user_path_walk_link_it(name,nd) \
707 +       __user_walk_it(name, 0, nd)
708 +extern void intent_release(struct lookup_intent *);
709  #define user_path_walk(name,nd) \
710         __user_walk(name, LOOKUP_FOLLOW, nd)
711  #define user_path_walk_link(name,nd) \
712 @@ -60,7 +99,6 @@
713  
714  extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
715  extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
716 -
717  extern int follow_down(struct vfsmount **, struct dentry **);
718  extern int follow_up(struct vfsmount **, struct dentry **);
719  
720 Index: linux-2.6.3-20/kernel/exit.c
721 ===================================================================
722 --- linux-2.6.3-20.orig/kernel/exit.c   2004-03-05 02:07:17.000000000 -0800
723 +++ linux-2.6.3-20/kernel/exit.c        2004-03-08 14:23:41.000000000 -0800
724 @@ -258,6 +258,8 @@
725         write_unlock_irq(&tasklist_lock);
726  }
727  
728 +EXPORT_SYMBOL(reparent_to_init);
729 +
730  void __set_special_pids(pid_t session, pid_t pgrp)
731  {
732         struct task_struct *curr = current;
733 @@ -427,6 +429,8 @@
734         __exit_files(tsk);
735  }
736  
737 +EXPORT_SYMBOL(exit_files);
738 +
739  static inline void __put_fs_struct(struct fs_struct *fs)
740  {
741         /* No need to hold fs->lock if we are killing it */