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