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