Whamcloud - gitweb
e00f2f34ebb5cb729f5701f26ef0d454ea4aad93
[fs/lustre-release.git] / lustre / kernel_patches / patches / vfs_intent-2.6-rhel4.patch
1 Index: linux-2.6.9-5.0.3.EL/fs/exec.c
2 ===================================================================
3 --- linux-2.6.9-5.0.3.EL.orig/fs/exec.c 2005-02-26 14:28:01.373228096 +0200
4 +++ linux-2.6.9-5.0.3.EL/fs/exec.c      2005-02-26 14:32:04.728232512 +0200
5 @@ -124,9 +124,10 @@
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_walk(library, LOOKUP_FOLLOW|LOOKUP_OPEN, &nd);
13 +       nd.intent.it_flags = FMODE_READ|FMODE_EXEC;
14 +       error = __user_walk_it(library, LOOKUP_FOLLOW|LOOKUP_OPEN, &nd);
15         if (error)
16                 goto out;
17  
18 @@ -138,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 @@ -487,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 = FMODE_READ|FMODE_EXEC;
35 +       err = path_lookup(name, LOOKUP_FOLLOW, &nd);
36         file = ERR_PTR(err);
37  
38         if (!err) {
39 @@ -501,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.9-5.0.3.EL/fs/namei.c
49 ===================================================================
50 --- linux-2.6.9-5.0.3.EL.orig/fs/namei.c        2005-02-26 14:28:01.378227336 +0200
51 +++ linux-2.6.9-5.0.3.EL/fs/namei.c     2005-02-26 14:32:04.732231904 +0200
52 @@ -272,8 +272,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 @@ -363,7 +374,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 @@ -402,7 +416,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 @@ -432,7 +449,9 @@
96  static inline int __vfs_follow_link(struct nameidata *nd, const char *link)
97  {
98         int res = 0;
99 +       struct lookup_intent it = nd->intent;
100         char *name;
101 +
102         if (IS_ERR(link))
103                 goto fail;
104  
105 @@ -442,6 +461,9 @@
106                         /* weird __emul_prefix() stuff did it */
107                         goto out;
108         }
109 +       intent_init(&nd->intent, it.it_op);
110 +       nd->intent.it_flags = it.it_flags;
111 +       nd->intent.it_create_mode = it.it_create_mode;
112         res = link_path_walk(link, nd);
113  out:
114         if (nd->depth || res || nd->last_type!=LAST_NORM)
115 @@ -650,6 +672,33 @@
116         return PTR_ERR(dentry);
117  }
118  
119 +static int revalidate_special(struct nameidata *nd)
120 +{
121 +       struct dentry *dentry = nd->dentry;
122 +       int err, counter = 0;
123 +
124 +       if (!dentry->d_op || !dentry->d_op->d_revalidate)
125 +               return 0;
126 + revalidate_again:
127 +       if (!dentry->d_op->d_revalidate(dentry, nd)) {
128 +               struct dentry *new;
129 +               if ((err = permission(dentry->d_parent->d_inode, MAY_EXEC, nd)))
130 +                       return err;
131 +               new = real_lookup(dentry->d_parent, &dentry->d_name, nd);
132 +               if (IS_ERR(new))
133 +                       return PTR_ERR(new);
134 +               d_invalidate(dentry);
135 +               dput(dentry);
136 +               nd->dentry = dentry = new;
137 +               counter++;
138 +               if (counter < 10)
139 +                       goto revalidate_again;
140 +               printk("excessive revalidate_it loops\n");
141 +               return -ESTALE;
142 +       }
143 +       return 0;
144 +}
145 +
146  /*
147   * Name resolution.
148   *
149 @@ -752,7 +801,9 @@
150  
151                 if (inode->i_op->follow_link) {
152                         mntget(next.mnt);
153 +                       nd->flags |= LOOKUP_LINK_NOTLAST;
154                         err = do_follow_link(next.dentry, nd);
155 +                       nd->flags &= ~LOOKUP_LINK_NOTLAST;
156                         dput(next.dentry);
157                         mntput(next.mnt);
158                         if (err)
159 @@ -791,14 +842,34 @@
160                                 inode = nd->dentry->d_inode;
161                                 /* fallthrough */
162                         case 1:
163 +                               nd->flags |= LOOKUP_LAST;
164 +                               err = revalidate_special(nd);
165 +                               nd->flags &= ~LOOKUP_LAST;
166 +                               if (!nd->dentry->d_inode)
167 +                                       err = -ENOENT;
168 +                               if (err) {
169 +                                       path_release(nd);
170 +                                       goto return_err;
171 +                               }
172 +                               if (lookup_flags & LOOKUP_DIRECTORY) {
173 +                                       err = -ENOTDIR;
174 +                                       if(!nd->dentry->d_inode->i_op ||
175 +                                         !nd->dentry->d_inode->i_op->lookup) {
176 +                                               path_release(nd);
177 +                                               goto return_err;
178 +                                       }
179 +                               }
180                                 goto return_reval;
181                 }
182 +               
183                 if (nd->dentry->d_op && nd->dentry->d_op->d_hash) {
184                         err = nd->dentry->d_op->d_hash(nd->dentry, &this);
185                         if (err < 0)
186                                 break;
187                 }
188 +               nd->flags |= LOOKUP_LAST;
189                 err = do_lookup(nd, &this, &next, atomic);
190 +               nd->flags &= ~LOOKUP_LAST;
191                 if (err)
192                         break;
193                 follow_mount(&next.mnt, &next.dentry);
194 @@ -1016,7 +1087,7 @@
195  }
196  
197  /* SMP-safe */
198 -struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
199 +struct dentry * lookup_one_len_it(const char * name, struct dentry * base, int len, struct nameidata *nd)
200  {
201         unsigned long hash;
202         struct qstr this;
203 @@ -1036,11 +1107,16 @@
204         }
205         this.hash = end_name_hash(hash);
206  
207 -       return lookup_hash(&this, base);
208 +       return __lookup_hash(&this, base, nd);
209  access:
210         return ERR_PTR(-EACCES);
211  }
212  
213 +struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
214 +{
215 +       return lookup_one_len_it(name, base, len, NULL);
216 +}
217 +
218  /*
219   *     namei()
220   *
221 @@ -1052,7 +1128,7 @@
222   * that namei follows links, while lnamei does not.
223   * SMP-safe
224   */
225 -int fastcall __user_walk(const char __user *name, unsigned flags, struct nameidata *nd)
226 +int fastcall __user_walk_it(const char __user *name, unsigned flags, struct nameidata *nd)
227  {
228         char *tmp = getname(name);
229         int err = PTR_ERR(tmp);
230 @@ -1064,6 +1140,12 @@
231         return err;
232  }
233  
234 +int fastcall __user_walk(const char __user *name, unsigned flags, struct nameidata *nd)
235 +{
236 +       intent_init(&nd->intent, IT_LOOKUP);
237 +       return __user_walk_it(name, flags, nd);
238 +}
239 +
240  /*
241   * It's inline, so penalty for filesystems that don't use sticky bit is
242   * minimal.
243 @@ -1347,8 +1429,8 @@
244                 acc_mode |= MAY_APPEND;
245  
246         /* Fill in the open() intent data */
247 -       nd->intent.open.flags = flag;
248 -       nd->intent.open.create_mode = mode;
249 +       nd->intent.it_flags = flag;
250 +       nd->intent.it_create_mode = mode;
251  
252         /*
253          * The simplest case - just a plain lookup.
254 @@ -1363,6 +1445,7 @@
255         /*
256          * Create - we need to know the parent.
257          */
258 +       nd->intent.it_op |= IT_CREAT;
259         error = path_lookup(pathname, LOOKUP_PARENT|LOOKUP_OPEN|LOOKUP_CREATE, nd);
260         if (error)
261                 return error;
262 @@ -1379,7 +1462,9 @@
263         dir = nd->dentry;
264         nd->flags &= ~LOOKUP_PARENT;
265         down(&dir->d_inode->i_sem);
266 +       nd->flags |= LOOKUP_LAST;
267         dentry = __lookup_hash(&nd->last, nd->dentry, nd);
268 +       nd->flags &= ~LOOKUP_LAST;
269  
270  do_last:
271         error = PTR_ERR(dentry);
272 @@ -1492,7 +1577,9 @@
273         }
274         dir = nd->dentry;
275         down(&dir->d_inode->i_sem);
276 +       nd->flags |= LOOKUP_LAST;
277         dentry = __lookup_hash(&nd->last, nd->dentry, nd);
278 +       nd->flags &= ~LOOKUP_LAST;
279         putname(nd->last.name);
280         goto do_last;
281  }
282 Index: linux-2.6.9-5.0.3.EL/fs/namespace.c
283 ===================================================================
284 --- linux-2.6.9-5.0.3.EL.orig/fs/namespace.c    2005-02-26 14:28:01.381226880 +0200
285 +++ linux-2.6.9-5.0.3.EL/fs/namespace.c 2005-02-26 14:32:04.734231600 +0200
286 @@ -61,6 +61,7 @@
287                 INIT_LIST_HEAD(&mnt->mnt_mounts);
288                 INIT_LIST_HEAD(&mnt->mnt_list);
289                 INIT_LIST_HEAD(&mnt->mnt_fslink);
290 +               INIT_LIST_HEAD(&mnt->mnt_lustre_list);
291                 if (name) {
292                         int size = strlen(name)+1;
293                         char *newname = kmalloc(size, GFP_KERNEL);
294 @@ -114,6 +115,7 @@
295  
296  static void detach_mnt(struct vfsmount *mnt, struct nameidata *old_nd)
297  {
298 +       memset(old_nd, 0, sizeof(*old_nd));
299         old_nd->dentry = mnt->mnt_mountpoint;
300         old_nd->mnt = mnt->mnt_parent;
301         mnt->mnt_parent = mnt;
302 @@ -177,6 +179,9 @@
303  {
304         struct super_block *sb = mnt->mnt_sb;
305         dput(mnt->mnt_root);
306 +        spin_lock(&dcache_lock);
307 +        list_del(&mnt->mnt_lustre_list);
308 +        spin_unlock(&dcache_lock);
309         free_vfsmnt(mnt);
310         deactivate_super(sb);
311  }
312 @@ -403,6 +408,8 @@
313          */
314  
315         lock_kernel();
316 +       if (sb->s_op->umount_lustre)
317 +              sb->s_op->umount_lustre(sb);
318         if( (flags&MNT_FORCE) && sb->s_op->umount_begin)
319                 sb->s_op->umount_begin(sb);
320         unlock_kernel();
321 @@ -627,6 +634,7 @@
322                 return err;
323         if (!old_name || !*old_name)
324                 return -EINVAL;
325 +       intent_init(&old_nd.intent, IT_LOOKUP);
326         err = path_lookup(old_name, LOOKUP_FOLLOW, &old_nd);
327         if (err)
328                 return err;
329 @@ -701,6 +709,7 @@
330                 return -EPERM;
331         if (!old_name || !*old_name)
332                 return -EINVAL;
333 +       intent_init(&old_nd.intent, IT_LOOKUP);
334         err = path_lookup(old_name, LOOKUP_FOLLOW, &old_nd);
335         if (err)
336                 return err;
337 @@ -1012,6 +1021,7 @@
338         int retval = 0;
339         int mnt_flags = 0;
340  
341 +       intent_init(&nd.intent, IT_LOOKUP);
342         /* Discard magic */
343         if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
344                 flags &= ~MS_MGC_MSK;
345 Index: linux-2.6.9-5.0.3.EL/fs/open.c
346 ===================================================================
347 --- linux-2.6.9-5.0.3.EL.orig/fs/open.c 2005-02-26 14:28:01.383226576 +0200
348 +++ linux-2.6.9-5.0.3.EL/fs/open.c      2005-02-26 14:32:04.736231296 +0200
349 @@ -215,12 +215,12 @@
350         struct nameidata nd;
351         struct inode * inode;
352         int error;
353 -
354 +       intent_init(&nd.intent, IT_GETATTR);
355         error = -EINVAL;
356         if (length < 0) /* sorry, but loff_t says... */
357                 goto out;
358  
359 -       error = user_path_walk(path, &nd);
360 +       error = user_path_walk_it(path, &nd);
361         if (error)
362                 goto out;
363         inode = nd.dentry->d_inode;
364 @@ -474,6 +474,7 @@
365         int old_fsuid, old_fsgid;
366         kernel_cap_t old_cap;
367         int res;
368 +       intent_init(&nd.intent, IT_GETATTR);
369  
370         if (mode & ~S_IRWXO)    /* where's F_OK, X_OK, W_OK, R_OK? */
371                 return -EINVAL;
372 @@ -498,13 +499,14 @@
373         else
374                 current->cap_effective = current->cap_permitted;
375  
376 -       res = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd);
377 +       res = __user_walk_it(filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd);
378         if (!res) {
379                 res = permission(nd.dentry->d_inode, mode, &nd);
380                 /* SuS v2 requires we report a read only fs too */
381                 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
382                    && !special_file(nd.dentry->d_inode->i_mode))
383                         res = -EROFS;
384 +
385                 path_release(&nd);
386         }
387  
388 @@ -519,8 +521,9 @@
389  {
390         struct nameidata nd;
391         int error;
392 +       intent_init(&nd.intent, IT_GETATTR);
393  
394 -       error = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &nd);
395 +       error = __user_walk_it(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &nd);
396         if (error)
397                 goto out;
398  
399 @@ -572,8 +575,9 @@
400  {
401         struct nameidata nd;
402         int error;
403 +       intent_init(&nd.intent, IT_GETATTR);
404  
405 -       error = __user_walk(filename, LOOKUP_FOLLOW | LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
406 +       error = __user_walk_it(filename, LOOKUP_FOLLOW | LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
407         if (error)
408                 goto out;
409  
410 @@ -754,27 +758,8 @@
411   * for the internal routines (ie open_namei()/follow_link() etc). 00 is
412   * used by symlinks.
413   */
414 -struct file *filp_open(const char * filename, int flags, int mode)
415 -{
416 -       int namei_flags, error;
417 -       struct nameidata nd;
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 -               return dentry_open(nd.dentry, nd.mnt, flags);
428 -
429 -       return ERR_PTR(error);
430 -}
431 -
432 -EXPORT_SYMBOL(filp_open);
433 -
434 -struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
435 +struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt, int flags,
436 +                           struct lookup_intent *it)
437  {
438         struct file * f;
439         struct inode *inode;
440 @@ -786,6 +771,7 @@
441                 goto cleanup_dentry;
442         f->f_flags = flags;
443         f->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE;
444 +       f->f_it = it;
445         inode = dentry->d_inode;
446         if (f->f_mode & FMODE_WRITE) {
447                 error = get_write_access(inode);
448 @@ -804,6 +790,7 @@
449                 error = f->f_op->open(inode,f);
450                 if (error)
451                         goto cleanup_all;
452 +               intent_release(it);
453         }
454         f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
455  
456 @@ -829,6 +816,7 @@
457  cleanup_file:
458         put_filp(f);
459  cleanup_dentry:
460 +       intent_release(it);
461         dput(dentry);
462         mntput(mnt);
463         return ERR_PTR(error);
464 @@ -836,6 +824,36 @@
465  
466  EXPORT_SYMBOL(dentry_open);
467  
468 +struct file *filp_open(const char * filename, int flags, int mode)
469 +{
470 +       int namei_flags, error;
471 +       struct file * temp_filp;
472 +       struct nameidata nd;
473 +       intent_init(&nd.intent, IT_OPEN);
474 +
475 +       namei_flags = flags;
476 +       if ((namei_flags+1) & O_ACCMODE)
477 +               namei_flags++;
478 +       if (namei_flags & O_TRUNC)
479 +               namei_flags |= 2;
480 +
481 +       error = open_namei(filename, namei_flags, mode, &nd);
482 +       if (!error) {
483 +               temp_filp = dentry_open_it(nd.dentry, nd.mnt, flags, &nd.intent);
484 +               return temp_filp;
485 +       }       
486 +       return ERR_PTR(error);
487 +}
488 +
489 +
490 +struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
491 +{
492 +       struct lookup_intent it;
493 +       intent_init(&it, IT_LOOKUP);
494 +
495 +       return dentry_open_it(dentry, mnt, flags, &it);
496 +}
497 +
498  /*
499   * Find an empty file descriptor entry, and mark it busy.
500   */
501 Index: linux-2.6.9-5.0.3.EL/fs/stat.c
502 ===================================================================
503 --- linux-2.6.9-5.0.3.EL.orig/fs/stat.c 2005-02-26 14:28:01.384226424 +0200
504 +++ linux-2.6.9-5.0.3.EL/fs/stat.c      2005-02-26 14:32:04.738230992 +0200
505 @@ -37,7 +37,7 @@
506  
507  EXPORT_SYMBOL(generic_fillattr);
508  
509 -int vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
510 +int vfs_getattr_it(struct vfsmount *mnt, struct dentry *dentry, struct lookup_intent *it, struct kstat *stat)
511  {
512         struct inode *inode = dentry->d_inode;
513         int retval;
514 @@ -46,6 +46,8 @@
515         if (retval)
516                 return retval;
517  
518 +       if (inode->i_op->getattr_it)
519 +               return inode->i_op->getattr_it(mnt, dentry, it, stat);
520         if (inode->i_op->getattr)
521                 return inode->i_op->getattr(mnt, dentry, stat);
522  
523 @@ -62,14 +64,20 @@
524  
525  EXPORT_SYMBOL(vfs_getattr);
526  
527 +int vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
528 +{
529 +       return vfs_getattr_it(mnt, dentry, NULL, stat);
530 +}
531 +
532  int vfs_stat(char __user *name, struct kstat *stat)
533  {
534         struct nameidata nd;
535         int error;
536 +       intent_init(&nd.intent, IT_GETATTR);
537  
538 -       error = user_path_walk(name, &nd);
539 +       error = user_path_walk_it(name, &nd);
540         if (!error) {
541 -               error = vfs_getattr(nd.mnt, nd.dentry, stat);
542 +               error = vfs_getattr_it(nd.mnt, nd.dentry, &nd.intent, stat);
543                 path_release(&nd);
544         }
545         return error;
546 @@ -81,10 +89,11 @@
547  {
548         struct nameidata nd;
549         int error;
550 +       intent_init(&nd.intent, IT_GETATTR);
551  
552 -       error = user_path_walk_link(name, &nd);
553 +       error = user_path_walk_link_it(name, &nd);
554         if (!error) {
555 -               error = vfs_getattr(nd.mnt, nd.dentry, stat);
556 +               error = vfs_getattr_it(nd.mnt, nd.dentry, &nd.intent, stat);
557                 path_release(&nd);
558         }
559         return error;
560 @@ -96,9 +105,12 @@
561  {
562         struct file *f = fget(fd);
563         int error = -EBADF;
564 +       struct nameidata nd;
565 +       intent_init(&nd.intent, IT_GETATTR);
566  
567         if (f) {
568 -               error = vfs_getattr(f->f_vfsmnt, f->f_dentry, stat);
569 +               error = vfs_getattr_it(f->f_vfsmnt, f->f_dentry, &nd.intent, stat);
570 +               intent_release(&nd.intent);
571                 fput(f);
572         }
573         return error;
574 Index: linux-2.6.9-5.0.3.EL/fs/nfs/dir.c
575 ===================================================================
576 --- linux-2.6.9-5.0.3.EL.orig/fs/nfs/dir.c      2005-02-26 14:28:01.387225968 +0200
577 +++ linux-2.6.9-5.0.3.EL/fs/nfs/dir.c   2005-02-26 14:32:04.740230688 +0200
578 @@ -718,7 +718,7 @@
579                 return 0;
580         if (!nd || (nd->flags & LOOKUP_CONTINUE) || !(nd->flags & LOOKUP_CREATE))
581                 return 0;
582 -       return (nd->intent.open.flags & O_EXCL) != 0;
583 +       return (nd->intent.it_flags & O_EXCL) != 0;
584  }
585  
586  static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
587 @@ -1043,7 +1043,7 @@
588         attr.ia_valid = ATTR_MODE;
589  
590         if (nd && (nd->flags & LOOKUP_CREATE))
591 -               open_flags = nd->intent.open.flags;
592 +               open_flags = nd->intent.it_flags;
593  
594         /*
595          * The 0 argument passed into the create function should one day
596 Index: linux-2.6.9-5.0.3.EL/fs/inode.c
597 ===================================================================
598 --- linux-2.6.9-5.0.3.EL.orig/fs/inode.c        2005-02-26 14:28:01.389225664 +0200
599 +++ linux-2.6.9-5.0.3.EL/fs/inode.c     2005-02-26 14:32:04.742230384 +0200
600 @@ -233,6 +233,7 @@
601         inodes_stat.nr_unused--;
602  }
603  
604 +EXPORT_SYMBOL(__iget);
605  /**
606   * clear_inode - clear an inode
607   * @inode: inode to clear
608 Index: linux-2.6.9-5.0.3.EL/include/linux/dcache.h
609 ===================================================================
610 --- linux-2.6.9-5.0.3.EL.orig/include/linux/dcache.h    2005-02-26 14:28:01.390225512 +0200
611 +++ linux-2.6.9-5.0.3.EL/include/linux/dcache.h 2005-02-26 14:32:04.743230232 +0200
612 @@ -4,6 +4,7 @@
613  #ifdef __KERNEL__
614  
615  #include <asm/atomic.h>
616 +#include <linux/string.h>
617  #include <linux/list.h>
618  #include <linux/spinlock.h>
619  #include <linux/cache.h>
620 @@ -37,6 +38,8 @@
621         const unsigned char *name;
622  };
623  
624 +#include <linux/namei.h>
625 +
626  struct dentry_stat_t {
627         int nr_dentry;
628         int nr_unused;
629 Index: linux-2.6.9-5.0.3.EL/include/linux/fs.h
630 ===================================================================
631 --- linux-2.6.9-5.0.3.EL.orig/include/linux/fs.h        2005-02-26 14:28:01.393225056 +0200
632 +++ linux-2.6.9-5.0.3.EL/include/linux/fs.h     2005-02-26 14:32:04.745229928 +0200
633 @@ -74,6 +74,7 @@
634  
635  #define FMODE_READ 1
636  #define FMODE_WRITE 2
637 +#define FMODE_EXEC 4
638  
639  /* Internal kernel extensions */
640  #define FMODE_LSEEK    4
641 @@ -258,6 +259,8 @@
642  #define ATTR_ATTR_FLAG 1024
643  #define ATTR_KILL_SUID 2048
644  #define ATTR_KILL_SGID 4096
645 +#define ATTR_RAW               8192    /* file system, not vfs will massage attrs */
646 +#define ATTR_FROM_OPEN         16384    /* called from open path, ie O_TRUNC */
647  
648  /*
649   * This is the Inode Attributes structure, used for notify_change().  It
650 @@ -456,6 +459,7 @@
651         struct block_device     *i_bdev;
652         struct cdev             *i_cdev;
653         int                     i_cindex;
654 +       void                    *i_filterdata;
655  
656         __u32                   i_generation;
657  
658 @@ -589,6 +593,7 @@
659         spinlock_t              f_ep_lock;
660  #endif /* #ifdef CONFIG_EPOLL */
661         struct address_space    *f_mapping;
662 +       struct lookup_intent    *f_it;
663  };
664  extern spinlock_t files_lock;
665  #define file_list_lock() spin_lock(&files_lock);
666 @@ -934,7 +939,9 @@
667         void (*truncate) (struct inode *);
668         int (*permission) (struct inode *, int, struct nameidata *);
669         int (*setattr) (struct dentry *, struct iattr *);
670 +       int (*setattr_raw) (struct inode *, struct iattr *);
671         int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
672 +       int (*getattr_it) (struct vfsmount *, struct dentry *, struct lookup_intent *, struct kstat *);
673         int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
674         ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
675         ssize_t (*listxattr) (struct dentry *, char *, size_t);
676 @@ -974,6 +981,7 @@
677         int (*remount_fs) (struct super_block *, int *, char *);
678         void (*clear_inode) (struct inode *);
679         void (*umount_begin) (struct super_block *);
680 +       void (*umount_lustre) (struct super_block *);
681  
682         int (*show_options)(struct seq_file *, struct vfsmount *);
683  };
684 @@ -1164,6 +1172,7 @@
685  extern struct vfsmount *kern_mount(struct file_system_type *);
686  extern int may_umount_tree(struct vfsmount *);
687  extern int may_umount(struct vfsmount *);
688 +struct vfsmount *do_kern_mount(const char *type, int flags, const char *name, void *data);
689  extern long do_mount(char *, char *, char *, unsigned long, void *);
690  
691  extern int vfs_statfs(struct super_block *, struct kstatfs *);
692 @@ -1228,6 +1237,7 @@
693  extern int do_truncate(struct dentry *, loff_t start);
694  extern struct file *filp_open(const char *, int, int);
695  extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
696 +extern struct file * dentry_open_it(struct dentry *, struct vfsmount *, int, struct lookup_intent *);
697  extern int filp_close(struct file *, fl_owner_t id);
698  extern char * getname(const char __user *);
699  
700 Index: linux-2.6.9-5.0.3.EL/include/linux/namei.h
701 ===================================================================
702 --- linux-2.6.9-5.0.3.EL.orig/include/linux/namei.h     2005-02-26 14:28:01.396224600 +0200
703 +++ linux-2.6.9-5.0.3.EL/include/linux/namei.h  2005-02-26 14:32:04.747229624 +0200
704 @@ -2,14 +2,48 @@
705  #define _LINUX_NAMEI_H
706  
707  #include <linux/linkage.h>
708 +#include <linux/string.h>
709  
710  struct vfsmount;
711 +struct nameidata;
712  
713 -struct open_intent {
714 -       int     flags;
715 -       int     create_mode;
716 +/* intent opcodes */
717 +#define IT_OPEN                (1)
718 +#define IT_CREAT       (1<<1)
719 +#define IT_READDIR     (1<<2)
720 +#define IT_GETATTR     (1<<3)
721 +#define IT_LOOKUP      (1<<4)
722 +#define IT_UNLINK      (1<<5)
723 +#define IT_TRUNC       (1<<6)
724 +#define IT_GETXATTR    (1<<7)
725 +
726 +struct lustre_intent_data {
727 +       int     it_disposition;
728 +       int     it_status;
729 +       __u64   it_lock_handle;
730 +       void    *it_data;
731 +       int     it_lock_mode;
732  };
733  
734 +#define INTENT_MAGIC 0x19620323
735 +struct lookup_intent {
736 +       int     it_magic;
737 +       void    (*it_op_release)(struct lookup_intent *);
738 +       int     it_op;
739 +       int     it_flags;
740 +       int     it_create_mode;
741 +       union {
742 +               struct lustre_intent_data lustre;
743 +       } d;
744 +};
745 +
746 +static inline void intent_init(struct lookup_intent *it, int op)
747 +{
748 +       memset(it, 0, sizeof(*it));
749 +       it->it_magic = INTENT_MAGIC;
750 +       it->it_op = op;
751 +}
752 +
753  enum { MAX_NESTED_LINKS = 8 };
754  
755  struct nameidata {
756 @@ -21,10 +56,7 @@
757         unsigned        depth;
758         char *saved_names[MAX_NESTED_LINKS + 1];
759  
760 -       /* Intent data */
761 -       union {
762 -               struct open_intent open;
763 -       } intent;
764 +       struct lookup_intent intent;
765  };
766  
767  /*
768 @@ -46,6 +78,8 @@
769  #define LOOKUP_PARENT          16
770  #define LOOKUP_NOALT           32
771  #define LOOKUP_ATOMIC          64
772 +#define LOOKUP_LAST            (0x1000)
773 +#define LOOKUP_LINK_NOTLAST    (0x2000)
774  
775  /*
776   * Intent data
777 @@ -55,6 +89,12 @@
778  #define LOOKUP_ACCESS          (0x0400)
779  
780  extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *));
781 +extern int FASTCALL(__user_walk_it(const char __user *name, unsigned flags, struct nameidata *nd));
782 +#define user_path_walk_it(name,nd) \
783 +       __user_walk_it(name, LOOKUP_FOLLOW, nd)
784 +#define user_path_walk_link_it(name,nd) \
785 +       __user_walk_it(name, 0, nd)
786 +extern void intent_release(struct lookup_intent *);
787  #define user_path_walk(name,nd) \
788         __user_walk(name, LOOKUP_FOLLOW, nd)
789  #define user_path_walk_link(name,nd) \
790 @@ -67,7 +107,6 @@
791  
792  extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
793  extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
794 -
795  extern int follow_down(struct vfsmount **, struct dentry **);
796  extern int follow_up(struct vfsmount **, struct dentry **);
797  
798 Index: linux-2.6.9-5.0.3.EL/include/linux/mount.h
799 ===================================================================
800 --- linux-2.6.9-5.0.3.EL.orig/include/linux/mount.h     2005-02-26 14:28:01.397224448 +0200
801 +++ linux-2.6.9-5.0.3.EL/include/linux/mount.h  2005-02-26 14:32:04.748229472 +0200
802 @@ -34,6 +34,8 @@
803         struct list_head mnt_list;
804         struct list_head mnt_fslink;    /* link in fs-specific expiry list */
805         struct namespace *mnt_namespace; /* containing namespace */
806 +       struct list_head mnt_lustre_list; /* GNS mount list */
807 +       unsigned long mnt_last_used;    /* for GNS auto-umount (jiffies) */
808  };
809  
810  static inline struct vfsmount *mntget(struct vfsmount *mnt)
811 Index: linux-2.6.9-5.0.3.EL/kernel/exit.c
812 ===================================================================
813 --- linux-2.6.9-5.0.3.EL.orig/kernel/exit.c     2005-02-26 14:28:01.399224144 +0200
814 +++ linux-2.6.9-5.0.3.EL/kernel/exit.c  2005-02-26 14:32:04.750229168 +0200
815 @@ -244,6 +244,8 @@
816         write_unlock_irq(&tasklist_lock);
817  }
818  
819 +EXPORT_SYMBOL(reparent_to_init);
820 +
821  void __set_special_pids(pid_t session, pid_t pgrp)
822  {
823         struct task_struct *curr = current;
824 @@ -428,6 +430,8 @@
825         __exit_files(tsk);
826  }
827  
828 +EXPORT_SYMBOL(exit_files);
829 +
830  static inline void __put_fs_struct(struct fs_struct *fs)
831  {
832         /* No need to hold fs->lock if we are killing it */