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