2 fs/namei.c | 228 ++++++++++++++++++++++++++++++++++++++-----------
4 fs/open.c | 53 +++++++++--
6 include/linux/dcache.h | 31 ++++++
7 include/linux/fs.h | 13 ++
9 8 files changed, 278 insertions(+), 62 deletions(-)
11 --- linux-2.4.18-18.8.0-l4/fs/dcache.c~vfs_intent-2.4.18-18 Sat Dec 14 06:31:22 2002
12 +++ linux-2.4.18-18.8.0-l4-root/fs/dcache.c Sat Dec 14 06:31:22 2002
13 @@ -150,6 +150,8 @@ repeat:
15 list_del_init(&dentry->d_hash);
20 struct dentry *parent;
21 list_del(&dentry->d_child);
22 @@ -645,6 +647,7 @@ struct dentry * d_alloc(struct dentry *
23 dentry->d_fsdata = NULL;
24 dentry->d_extra_attributes = NULL;
25 dentry->d_mounted = 0;
26 + dentry->d_it = NULL;
27 INIT_LIST_HEAD(&dentry->d_hash);
28 INIT_LIST_HEAD(&dentry->d_lru);
29 INIT_LIST_HEAD(&dentry->d_subdirs);
30 --- linux-2.4.18-18.8.0-l4/fs/namei.c~vfs_intent-2.4.18-18 Sat Dec 14 06:31:22 2002
31 +++ linux-2.4.18-18.8.0-l4-root/fs/namei.c Sat Dec 14 06:37:21 2002
40 * XEmacs seems to be relying on it...
43 +void intent_release(struct dentry *de, struct lookup_intent *it)
45 + if (it && de->d_op && de->d_op->d_intent_release)
46 + de->d_op->d_intent_release(de, it);
51 /* In order to reduce some races, while at the same time doing additional
52 * checking and hopefully speeding things up, we copy filenames to the
53 * kernel data space before using them..
54 @@ -260,10 +271,19 @@ void path_release(struct nameidata *nd)
55 * Internal lookup() using the new generic dcache.
58 -static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name, int flags)
59 +static struct dentry *cached_lookup(struct dentry *parent, struct qstr *name,
60 + int flags, struct lookup_intent *it)
62 struct dentry * dentry = d_lookup(parent, name);
64 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate2) {
65 + if (!dentry->d_op->d_revalidate2(dentry, flags, it) &&
66 + !d_invalidate(dentry)) {
72 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
73 if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) {
75 @@ -281,7 +301,8 @@ static struct dentry * cached_lookup(str
76 * make sure that nobody added the entry to the dcache in the meantime..
79 -static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, int flags)
80 +static struct dentry *real_lookup(struct dentry *parent, struct qstr *name,
81 + int flags, struct lookup_intent *it)
83 struct dentry * result;
84 struct inode *dir = parent->d_inode;
85 @@ -300,6 +321,9 @@ static struct dentry * real_lookup(struc
86 result = ERR_PTR(-ENOMEM);
89 + if (dir->i_op->lookup2)
90 + result = dir->i_op->lookup2(dir, dentry, it);
92 result = dir->i_op->lookup(dir, dentry);
95 @@ -321,6 +345,12 @@ static struct dentry * real_lookup(struc
97 result = ERR_PTR(-ENOENT);
99 + } else if (result->d_op && result->d_op->d_revalidate2) {
100 + if (!result->d_op->d_revalidate2(result, flags, it) &&
101 + !d_invalidate(result)) {
103 + result = ERR_PTR(-ENOENT);
108 @@ -334,7 +364,8 @@ int max_recursive_link = 5;
109 * Without that kind of total limit, nasty chains of consecutive
110 * symlinks can cause almost arbitrarily long lookups.
112 -static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
113 +static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd,
114 + struct lookup_intent *it)
117 if (current->link_count >= max_recursive_link)
118 @@ -348,10 +379,14 @@ static inline int do_follow_link(struct
119 current->link_count++;
120 current->total_link_count++;
121 UPDATE_ATIME(dentry->d_inode);
122 - err = dentry->d_inode->i_op->follow_link(dentry, nd);
123 + if (dentry->d_inode->i_op->follow_link2)
124 + err = dentry->d_inode->i_op->follow_link2(dentry, nd, it);
126 + err = dentry->d_inode->i_op->follow_link(dentry, nd);
127 current->link_count--;
130 + intent_release(dentry, it);
134 @@ -449,7 +484,8 @@ static inline void follow_dotdot(struct
136 * We expect 'base' to be positive and a directory.
138 -int link_path_walk(const char * name, struct nameidata *nd)
139 +int link_path_walk_it(const char *name, struct nameidata *nd,
140 + struct lookup_intent *it)
142 struct dentry *dentry;
144 @@ -526,12 +562,12 @@ int link_path_walk(const char * name, st
147 /* This does the actual lookups.. */
148 - dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
149 + dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE, NULL);
151 err = -EWOULDBLOCKIO;
154 - dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
155 + dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE, NULL);
156 err = PTR_ERR(dentry);
159 @@ -548,8 +584,8 @@ int link_path_walk(const char * name, st
163 - if (inode->i_op->follow_link) {
164 - err = do_follow_link(dentry, nd);
165 + if (inode->i_op->follow_link || inode->i_op->follow_link2) {
166 + err = do_follow_link(dentry, nd, NULL);
170 @@ -565,7 +601,7 @@ int link_path_walk(const char * name, st
174 - if (!inode->i_op->lookup)
175 + if (!inode->i_op->lookup && !inode->i_op->lookup2)
178 /* here ends the main loop */
179 @@ -592,12 +628,12 @@ last_component:
183 - dentry = cached_lookup(nd->dentry, &this, 0);
184 + dentry = cached_lookup(nd->dentry, &this, 0, it);
186 err = -EWOULDBLOCKIO;
189 - dentry = real_lookup(nd->dentry, &this, 0);
190 + dentry = real_lookup(nd->dentry, &this, 0, it);
191 err = PTR_ERR(dentry);
194 @@ -606,8 +642,10 @@ last_component:
196 inode = dentry->d_inode;
197 if ((lookup_flags & LOOKUP_FOLLOW)
198 - && inode && inode->i_op && inode->i_op->follow_link) {
199 - err = do_follow_link(dentry, nd);
200 + && inode && inode->i_op &&
201 + (inode->i_op->follow_link ||
202 + inode->i_op->follow_link2)) {
203 + err = do_follow_link(dentry, nd, it);
207 @@ -621,7 +659,8 @@ last_component:
209 if (lookup_flags & LOOKUP_DIRECTORY) {
211 - if (!inode->i_op || !inode->i_op->lookup)
212 + if (!inode->i_op || (!inode->i_op->lookup &&
213 + !inode->i_op->lookup2))
217 @@ -663,10 +702,21 @@ return_err:
221 +int link_path_walk(const char * name, struct nameidata *nd)
223 + return link_path_walk_it(name, nd, NULL);
226 +int path_walk_it(const char * name, struct nameidata *nd, struct lookup_intent *it)
228 + current->total_link_count = 0;
229 + return link_path_walk_it(name, nd, it);
232 int path_walk(const char * name, struct nameidata *nd)
234 current->total_link_count = 0;
235 - return link_path_walk(name, nd);
236 + return link_path_walk_it(name, nd, NULL);
240 @@ -751,6 +801,17 @@ walk_init_root(const char *name, struct
244 +int path_lookup_it(const char *path, unsigned flags, struct nameidata *nd,
245 + struct lookup_intent *it)
248 + if (path_init(path, flags, nd))
249 + error = path_walk_it(path, nd, it);
255 int path_lookup(const char *path, unsigned flags, struct nameidata *nd)
258 @@ -779,7 +840,8 @@ int path_init(const char *name, unsigned
259 * needs parent already locked. Doesn't follow mounts.
262 -struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
263 +struct dentry * lookup_hash_it(struct qstr *name, struct dentry * base,
264 + struct lookup_intent *it)
266 struct dentry * dentry;
268 @@ -802,13 +864,16 @@ struct dentry * lookup_hash(struct qstr
272 - dentry = cached_lookup(base, name, 0);
273 + dentry = cached_lookup(base, name, 0, it);
275 struct dentry *new = d_alloc(base, name);
276 dentry = ERR_PTR(-ENOMEM);
280 + if (inode->i_op->lookup2)
281 + dentry = inode->i_op->lookup2(inode, new, it);
283 dentry = inode->i_op->lookup(inode, new);
286 @@ -820,6 +885,12 @@ out:
290 +struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
292 + return lookup_hash_it(name, base, NULL);
297 struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
299 @@ -841,7 +912,7 @@ struct dentry * lookup_one_len(const cha
301 this.hash = end_name_hash(hash);
303 - return lookup_hash(&this, base);
304 + return lookup_hash_it(&this, base, NULL);
306 return ERR_PTR(-EACCES);
308 @@ -872,6 +943,23 @@ int __user_walk(const char *name, unsign
312 +int __user_walk_it(const char *name, unsigned flags, struct nameidata *nd,
313 + struct lookup_intent *it)
318 + tmp = getname(name);
319 + err = PTR_ERR(tmp);
320 + if (!IS_ERR(tmp)) {
322 + if (path_init(tmp, flags, nd))
323 + err = path_walk_it(tmp, nd, it);
330 * It's inline, so penalty for filesystems that don't use sticky bit is
332 @@ -1045,14 +1133,17 @@ int may_open(struct nameidata *nd, int a
333 return get_lease(inode, flag);
336 +extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
337 + int flags, struct lookup_intent *it);
339 struct file *filp_open(const char * pathname, int open_flags, int mode)
341 int acc_mode, error = 0;
342 - struct inode *inode;
343 struct dentry *dentry;
345 int flag = open_flags;
347 + struct lookup_intent it = { .it_op = IT_OPEN };
350 if ((flag+1) & O_ACCMODE)
351 @@ -1066,7 +1157,7 @@ struct file *filp_open(const char * path
352 * The simplest case - just a plain lookup.
354 if (!(flag & O_CREAT)) {
355 - error = path_lookup(pathname, lookup_flags(flag), &nd);
356 + error = path_lookup_it(pathname, lookup_flags(flag), &nd, &it);
358 return ERR_PTR(error);
360 @@ -1076,6 +1167,8 @@ struct file *filp_open(const char * path
362 * Create - we need to know the parent.
365 + it.it_op |= IT_CREAT;
366 error = path_lookup(pathname, LOOKUP_PARENT, &nd);
368 return ERR_PTR(error);
369 @@ -1091,7 +1184,7 @@ struct file *filp_open(const char * path
372 down(&dir->d_inode->i_sem);
373 - dentry = lookup_hash(&nd.last, nd.dentry);
374 + dentry = lookup_hash_it(&nd.last, nd.dentry, &it);
377 error = PTR_ERR(dentry);
378 @@ -1100,6 +1193,7 @@ do_last:
383 /* Negative dentry, just create the file */
384 if (!dentry->d_inode) {
385 error = vfs_create(dir->d_inode, dentry,
386 @@ -1134,7 +1228,8 @@ do_last:
388 if (!dentry->d_inode)
390 - if (dentry->d_inode->i_op && dentry->d_inode->i_op->follow_link)
391 + if (dentry->d_inode->i_op && (dentry->d_inode->i_op->follow_link ||
392 + dentry->d_inode->i_op->follow_link2))
396 @@ -1149,11 +1244,13 @@ ok:
397 if (!S_ISREG(nd.dentry->d_inode->i_mode))
398 open_flags &= ~O_TRUNC;
400 - return dentry_open(nd.dentry, nd.mnt, open_flags);
401 + return dentry_open_it(nd.dentry, nd.mnt, open_flags, &it);
404 + intent_release(dentry, &it);
407 + intent_release(nd.dentry, &it);
409 return ERR_PTR(error);
411 @@ -1172,7 +1269,12 @@ do_link:
412 * are done. Procfs-like symlinks just set LAST_BIND.
414 UPDATE_ATIME(dentry->d_inode);
415 - error = dentry->d_inode->i_op->follow_link(dentry, &nd);
416 + if (dentry->d_inode->i_op->follow_link2)
417 + error = dentry->d_inode->i_op->follow_link2(dentry, &nd, &it);
419 + error = dentry->d_inode->i_op->follow_link(dentry, &nd);
421 + intent_release(dentry, &it);
425 @@ -1194,13 +1296,15 @@ do_link:
428 down(&dir->d_inode->i_sem);
429 - dentry = lookup_hash(&nd.last, nd.dentry);
430 + dentry = lookup_hash_it(&nd.last, nd.dentry, &it);
431 putname(nd.last.name);
437 -static struct dentry *lookup_create(struct nameidata *nd, int is_dir)
438 +static struct dentry *lookup_create(struct nameidata *nd, int is_dir,
439 + struct lookup_intent *it)
441 struct dentry *dentry;
443 @@ -1208,7 +1312,7 @@ static struct dentry *lookup_create(stru
444 dentry = ERR_PTR(-EEXIST);
445 if (nd->last_type != LAST_NORM)
447 - dentry = lookup_hash(&nd->last, nd->dentry);
448 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
451 if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
452 @@ -1254,6 +1358,7 @@ asmlinkage long sys_mknod(const char * f
454 struct dentry * dentry;
456 + struct lookup_intent it = { .it_op = IT_MKNOD, .it_mode = mode };
460 @@ -1264,7 +1369,7 @@ asmlinkage long sys_mknod(const char * f
461 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
464 - dentry = lookup_create(&nd, 0);
465 + dentry = lookup_create(&nd, 0, &it);
466 error = PTR_ERR(dentry);
468 mode &= ~current->fs->umask;
469 @@ -1282,6 +1387,7 @@ asmlinkage long sys_mknod(const char * f
473 + intent_release(dentry, &it);
476 up(&nd.dentry->d_inode->i_sem);
477 @@ -1322,6 +1428,7 @@ asmlinkage long sys_mkdir(const char * p
481 + struct lookup_intent it = { .it_op = IT_MKDIR, .it_mode = mode };
483 tmp = getname(pathname);
484 error = PTR_ERR(tmp);
485 @@ -1332,11 +1439,12 @@ asmlinkage long sys_mkdir(const char * p
486 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
489 - dentry = lookup_create(&nd, 1);
490 + dentry = lookup_create(&nd, 1, &it);
491 error = PTR_ERR(dentry);
492 if (!IS_ERR(dentry)) {
493 error = vfs_mkdir(nd.dentry->d_inode, dentry,
494 mode & ~current->fs->umask);
495 + intent_release(dentry, &it);
498 up(&nd.dentry->d_inode->i_sem);
499 @@ -1420,6 +1528,7 @@ asmlinkage long sys_rmdir(const char * p
501 struct dentry *dentry;
503 + struct lookup_intent it = { .it_op = IT_RMDIR };
505 name = getname(pathname);
507 @@ -1441,10 +1550,11 @@ asmlinkage long sys_rmdir(const char * p
510 down(&nd.dentry->d_inode->i_sem);
511 - dentry = lookup_hash(&nd.last, nd.dentry);
512 + dentry = lookup_hash_it(&nd.last, nd.dentry, &it);
513 error = PTR_ERR(dentry);
514 if (!IS_ERR(dentry)) {
515 error = vfs_rmdir(nd.dentry->d_inode, dentry);
516 + intent_release(dentry, &it);
519 up(&nd.dentry->d_inode->i_sem);
520 @@ -1488,6 +1598,7 @@ asmlinkage long sys_unlink(const char *
522 struct dentry *dentry;
524 + struct lookup_intent it = { .it_op = IT_UNLINK };
526 name = getname(pathname);
528 @@ -1500,7 +1611,7 @@ asmlinkage long sys_unlink(const char *
529 if (nd.last_type != LAST_NORM)
531 down(&nd.dentry->d_inode->i_sem);
532 - dentry = lookup_hash(&nd.last, nd.dentry);
533 + dentry = lookup_hash_it(&nd.last, nd.dentry, &it);
534 error = PTR_ERR(dentry);
535 if (!IS_ERR(dentry)) {
536 /* Why not before? Because we want correct error value */
537 @@ -1508,6 +1619,7 @@ asmlinkage long sys_unlink(const char *
539 error = vfs_unlink(nd.dentry->d_inode, dentry);
541 + intent_release(dentry, &it);
544 up(&nd.dentry->d_inode->i_sem);
545 @@ -1554,6 +1666,7 @@ asmlinkage long sys_symlink(const char *
549 + struct lookup_intent it = { .it_op = IT_SYMLINK };
551 from = getname(oldname);
553 @@ -1567,10 +1680,12 @@ asmlinkage long sys_symlink(const char *
554 error = path_lookup(to, LOOKUP_PARENT, &nd);
557 - dentry = lookup_create(&nd, 0);
559 + dentry = lookup_create(&nd, 0, &it);
560 error = PTR_ERR(dentry);
561 if (!IS_ERR(dentry)) {
562 error = vfs_symlink(nd.dentry->d_inode, dentry, from);
563 + intent_release(dentry, &it);
566 up(&nd.dentry->d_inode->i_sem);
567 @@ -1635,6 +1750,7 @@ asmlinkage long sys_link(const char * ol
571 + struct lookup_intent it = { .it_op = IT_LINK };
573 to = getname(newname);
575 @@ -1642,7 +1758,7 @@ asmlinkage long sys_link(const char * ol
576 struct dentry *new_dentry;
577 struct nameidata nd, old_nd;
579 - error = __user_walk(oldname, LOOKUP_POSITIVE, &old_nd);
580 + error = __user_walk_it(oldname, LOOKUP_POSITIVE, &old_nd, &it);
583 error = path_lookup(to, LOOKUP_PARENT, &nd);
584 @@ -1651,10 +1767,12 @@ asmlinkage long sys_link(const char * ol
586 if (old_nd.mnt != nd.mnt)
588 - new_dentry = lookup_create(&nd, 0);
589 + it.it_op = IT_LINK2;
590 + new_dentry = lookup_create(&nd, 0, &it);
591 error = PTR_ERR(new_dentry);
592 if (!IS_ERR(new_dentry)) {
593 error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
594 + intent_release(new_dentry, &it);
597 up(&nd.dentry->d_inode->i_sem);
598 @@ -1695,7 +1813,8 @@ exit:
601 int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
602 - struct inode *new_dir, struct dentry *new_dentry)
603 + struct inode *new_dir, struct dentry *new_dentry,
604 + struct lookup_intent *it)
607 struct inode *target;
608 @@ -1753,6 +1872,7 @@ int vfs_rename_dir(struct inode *old_dir
611 error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
612 + intent_release(new_dentry, it);
615 target->i_flags |= S_DEAD;
616 @@ -1774,7 +1894,8 @@ out_unlock:
619 int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
620 - struct inode *new_dir, struct dentry *new_dentry)
621 + struct inode *new_dir, struct dentry *new_dentry,
622 + struct lookup_intent *it)
626 @@ -1805,6 +1926,7 @@ int vfs_rename_other(struct inode *old_d
629 error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
630 + intent_release(new_dentry, it);
631 double_up(&old_dir->i_zombie, &new_dir->i_zombie);
634 @@ -1816,13 +1938,14 @@ int vfs_rename_other(struct inode *old_d
637 int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
638 - struct inode *new_dir, struct dentry *new_dentry)
639 + struct inode *new_dir, struct dentry *new_dentry,
640 + struct lookup_intent *it)
643 if (S_ISDIR(old_dentry->d_inode->i_mode))
644 - error = vfs_rename_dir(old_dir,old_dentry,new_dir,new_dentry);
645 + error = vfs_rename_dir(old_dir,old_dentry,new_dir,new_dentry,it);
647 - error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry);
648 + error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry,it);
650 if (old_dir == new_dir)
651 inode_dir_notify(old_dir, DN_RENAME);
652 @@ -1839,6 +1962,7 @@ static inline int do_rename(const char *
654 struct dentry * old_dir, * new_dir;
655 struct dentry * old_dentry, *new_dentry;
656 + struct lookup_intent it = { .it_op = IT_RENAME };
657 struct nameidata oldnd, newnd;
659 error = path_lookup(oldname, LOOKUP_PARENT, &oldnd);
660 @@ -1864,7 +1988,7 @@ static inline int do_rename(const char *
662 double_lock(new_dir, old_dir);
664 - old_dentry = lookup_hash(&oldnd.last, old_dir);
665 + old_dentry = lookup_hash_it(&oldnd.last, old_dir, &it);
666 error = PTR_ERR(old_dentry);
667 if (IS_ERR(old_dentry))
669 @@ -1880,18 +2004,21 @@ static inline int do_rename(const char *
670 if (newnd.last.name[newnd.last.len])
673 - new_dentry = lookup_hash(&newnd.last, new_dir);
674 + it.it_op = IT_RENAME2;
675 + new_dentry = lookup_hash_it(&newnd.last, new_dir, &it);
676 error = PTR_ERR(new_dentry);
677 if (IS_ERR(new_dentry))
681 error = vfs_rename(old_dir->d_inode, old_dentry,
682 - new_dir->d_inode, new_dentry);
683 + new_dir->d_inode, new_dentry, &it);
686 + intent_release(new_dentry, &it);
689 + intent_release(old_dentry, &it);
692 double_up(&new_dir->d_inode->i_sem, &old_dir->d_inode->i_sem);
693 @@ -1940,7 +2067,8 @@ out:
697 -__vfs_follow_link(struct nameidata *nd, const char *link)
698 +__vfs_follow_link(struct nameidata *nd, const char *link,
699 + struct lookup_intent *it)
703 @@ -1953,7 +2081,7 @@ __vfs_follow_link(struct nameidata *nd,
704 /* weird __emul_prefix() stuff did it */
707 - res = link_path_walk(link, nd);
708 + res = link_path_walk_it(link, nd, it);
710 if (current->link_count || res || nd->last_type!=LAST_NORM)
712 @@ -1975,7 +2103,13 @@ fail:
714 int vfs_follow_link(struct nameidata *nd, const char *link)
716 - return __vfs_follow_link(nd, link);
717 + return __vfs_follow_link(nd, link, NULL);
720 +int vfs_follow_link_it(struct nameidata *nd, const char *link,
721 + struct lookup_intent *it)
723 + return __vfs_follow_link(nd, link, it);
726 /* get the link contents into pagecache */
727 @@ -2017,7 +2151,7 @@ int page_follow_link(struct dentry *dent
729 struct page *page = NULL;
730 char *s = page_getlink(dentry, &page);
731 - int res = __vfs_follow_link(nd, s);
732 + int res = __vfs_follow_link(nd, s, NULL);
735 page_cache_release(page);
736 --- linux-2.4.18-18.8.0-l4/fs/nfsd/vfs.c~vfs_intent-2.4.18-18 Sat Dec 14 06:31:22 2002
737 +++ linux-2.4.18-18.8.0-l4-root/fs/nfsd/vfs.c Sat Dec 14 06:31:22 2002
738 @@ -1298,7 +1298,7 @@ nfsd_rename(struct svc_rqst *rqstp, stru
742 - err = vfs_rename(fdir, odentry, tdir, ndentry);
743 + err = vfs_rename(fdir, odentry, tdir, ndentry, NULL);
745 if (!err && EX_ISSYNC(tfhp->fh_export)) {
746 nfsd_sync_dir(tdentry);
747 --- linux-2.4.18-18.8.0-l4/fs/open.c~vfs_intent-2.4.18-18 Sat Dec 14 06:31:22 2002
748 +++ linux-2.4.18-18.8.0-l4-root/fs/open.c Sat Dec 14 06:31:22 2002
750 #include <asm/uaccess.h>
752 #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
753 +extern int path_walk_it(const char *name, struct nameidata *nd,
754 + struct lookup_intent *it);
755 +extern void intent_release(struct dentry *de, struct lookup_intent *it);
757 int vfs_statfs(struct super_block *sb, struct statfs *buf)
759 @@ -118,12 +121,13 @@ static inline long do_sys_truncate(const
761 struct inode * inode;
763 + struct lookup_intent it = { .it_op = IT_SETATTR };
766 if (length < 0) /* sorry, but loff_t says... */
769 - error = user_path_walk(path, &nd);
770 + error = user_path_walk_it(path, &nd, &it);
773 inode = nd.dentry->d_inode;
774 @@ -168,6 +172,7 @@ static inline long do_sys_truncate(const
775 put_write_access(inode);
778 + intent_release(nd.dentry, &it);
782 @@ -259,8 +264,9 @@ asmlinkage long sys_utime(char * filenam
784 struct inode * inode;
785 struct iattr newattrs;
786 + struct lookup_intent it = { .it_op = IT_SETATTR };
788 - error = user_path_walk(filename, &nd);
789 + error = user_path_walk_it(filename, &nd, &it);
792 inode = nd.dentry->d_inode;
793 @@ -286,6 +292,7 @@ asmlinkage long sys_utime(char * filenam
795 error = notify_change(nd.dentry, &newattrs);
797 + intent_release(nd.dentry, &it);
801 @@ -303,8 +310,9 @@ asmlinkage long sys_utimes(char * filena
803 struct inode * inode;
804 struct iattr newattrs;
805 + struct lookup_intent it = { .it_op = IT_SETATTR };
807 - error = user_path_walk(filename, &nd);
808 + error = user_path_walk_it(filename, &nd, &it);
812 @@ -331,6 +339,7 @@ asmlinkage long sys_utimes(char * filena
814 error = notify_change(nd.dentry, &newattrs);
816 + intent_release(nd.dentry, &it);
820 @@ -347,6 +356,7 @@ asmlinkage long sys_access(const char *
821 int old_fsuid, old_fsgid;
822 kernel_cap_t old_cap;
824 + struct lookup_intent it = { .it_op = IT_GETATTR };
826 if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
828 @@ -364,13 +374,14 @@ asmlinkage long sys_access(const char *
830 current->cap_effective = current->cap_permitted;
832 - res = user_path_walk(filename, &nd);
833 + res = user_path_walk_it(filename, &nd, &it);
835 res = permission(nd.dentry->d_inode, mode);
836 /* SuS v2 requires we report a read only fs too */
837 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
838 && !special_file(nd.dentry->d_inode->i_mode))
840 + intent_release(nd.dentry, &it);
844 @@ -385,8 +396,11 @@ asmlinkage long sys_chdir(const char * f
848 + struct lookup_intent it = { .it_op = IT_GETATTR };
850 - error = __user_walk(filename,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd);
851 + error = __user_walk_it(filename,
852 + LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,
857 @@ -397,6 +411,7 @@ asmlinkage long sys_chdir(const char * f
858 set_fs_pwd(current->fs, nd.mnt, nd.dentry);
861 + intent_release(nd.dentry, &it);
865 @@ -436,9 +451,10 @@ asmlinkage long sys_chroot(const char *
869 + struct lookup_intent it = { .it_op = IT_GETATTR };
871 - error = __user_walk(filename, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
872 - LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
873 + error = __user_walk_it(filename, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
874 + LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd, &it);
878 @@ -454,6 +470,7 @@ asmlinkage long sys_chroot(const char *
882 + intent_release(nd.dentry, &it);
886 @@ -498,8 +515,9 @@ asmlinkage long sys_chmod(const char * f
887 struct inode * inode;
889 struct iattr newattrs;
890 + struct lookup_intent it = { .it_op = IT_SETATTR };
892 - error = user_path_walk(filename, &nd);
893 + error = user_path_walk_it(filename, &nd, &it);
896 inode = nd.dentry->d_inode;
897 @@ -519,6 +537,7 @@ asmlinkage long sys_chmod(const char * f
898 error = notify_change(nd.dentry, &newattrs);
901 + intent_release(nd.dentry, &it);
905 @@ -588,10 +607,12 @@ asmlinkage long sys_chown(const char * f
909 + struct lookup_intent it = { .it_op = IT_SETATTR };
911 - error = user_path_walk(filename, &nd);
912 + error = user_path_walk_it(filename, &nd, &it);
914 error = chown_common(nd.dentry, user, group);
915 + intent_release(nd.dentry, &it);
919 @@ -601,10 +622,12 @@ asmlinkage long sys_lchown(const char *
923 + struct lookup_intent it = { .it_op = IT_SETATTR };
925 - error = user_path_walk_link(filename, &nd);
926 + error = user_path_walk_link_it(filename, &nd, &it);
928 error = chown_common(nd.dentry, user, group);
929 + intent_release(nd.dentry, &it);
933 @@ -628,7 +651,8 @@ extern ssize_t do_readahead(struct file
934 /* for files over a certains size it doesn't pay to do readahead on open */
935 #define READAHEAD_CUTOFF 48000
937 -struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
938 +struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
939 + int flags, struct lookup_intent *it)
943 @@ -693,6 +717,7 @@ struct file *dentry_open(struct dentry *
944 do_readahead(f, 0, (48 * 1024) >> PAGE_SHIFT);
947 + intent_release(dentry, it);
951 @@ -707,11 +732,17 @@ cleanup_all:
955 + intent_release(dentry, it);
958 return ERR_PTR(error);
961 +struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
963 + return dentry_open_it(dentry, mnt, flags, NULL);
967 * Find an empty file descriptor entry, and mark it busy.
969 --- linux-2.4.18-18.8.0-l4/fs/stat.c~vfs_intent-2.4.18-18 Sat Dec 14 06:31:22 2002
970 +++ linux-2.4.18-18.8.0-l4-root/fs/stat.c Sat Dec 14 06:31:22 2002
973 #include <asm/uaccess.h>
975 +extern void intent_release(struct dentry *de, struct lookup_intent *it);
977 * Revalidate the inode. This is required for proper NFS attribute caching.
979 @@ -104,10 +105,12 @@ int vfs_stat(char *name, struct kstat *s
983 + struct lookup_intent it = { .it_op = IT_GETATTR };
985 - error = user_path_walk(name, &nd);
986 + error = user_path_walk_it(name, &nd, &it);
988 error = do_getattr(nd.mnt, nd.dentry, stat);
989 + intent_release(nd.dentry, &it);
993 @@ -117,10 +120,12 @@ int vfs_lstat(char *name, struct kstat *
997 + struct lookup_intent it = { .it_op = IT_GETATTR };
999 - error = user_path_walk_link(name, &nd);
1000 + error = user_path_walk_link_it(name, &nd, &it);
1002 error = do_getattr(nd.mnt, nd.dentry, stat);
1003 + intent_release(nd.dentry, &it);
1007 --- linux-2.4.18-18.8.0-l4/include/linux/dcache.h~vfs_intent-2.4.18-18 Sat Dec 14 06:31:22 2002
1008 +++ linux-2.4.18-18.8.0-l4-root/include/linux/dcache.h Sat Dec 14 06:31:22 2002
1010 #include <asm/atomic.h>
1011 #include <linux/mount.h>
1013 +#define IT_OPEN (1)
1014 +#define IT_CREAT (1<<1)
1015 +#define IT_MKDIR (1<<2)
1016 +#define IT_LINK (1<<3)
1017 +#define IT_LINK2 (1<<4)
1018 +#define IT_SYMLINK (1<<5)
1019 +#define IT_UNLINK (1<<6)
1020 +#define IT_RMDIR (1<<7)
1021 +#define IT_RENAME (1<<8)
1022 +#define IT_RENAME2 (1<<9)
1023 +#define IT_READDIR (1<<10)
1024 +#define IT_GETATTR (1<<11)
1025 +#define IT_SETATTR (1<<12)
1026 +#define IT_READLINK (1<<13)
1027 +#define IT_MKNOD (1<<14)
1028 +#define IT_LOOKUP (1<<15)
1030 +struct lookup_intent {
1033 + int it_disposition;
1035 + struct iattr *it_iattr;
1036 + __u64 it_lock_handle[2];
1042 * linux/include/linux/dcache.h
1044 @@ -78,6 +106,7 @@ struct dentry {
1045 unsigned long d_time; /* used by d_revalidate */
1046 struct dentry_operations *d_op;
1047 struct super_block * d_sb; /* The root of the dentry tree */
1048 + struct lookup_intent *d_it;
1049 unsigned long d_vfs_flags;
1050 void * d_fsdata; /* fs-specific data */
1051 void * d_extra_attributes; /* TUX-specific data */
1052 @@ -91,6 +120,8 @@ struct dentry_operations {
1053 int (*d_delete)(struct dentry *);
1054 void (*d_release)(struct dentry *);
1055 void (*d_iput)(struct dentry *, struct inode *);
1056 + int (*d_revalidate2)(struct dentry *, int, struct lookup_intent *);
1057 + void (*d_intent_release)(struct dentry *, struct lookup_intent *);
1060 /* the dentry parameter passed to d_hash and d_compare is the parent
1061 --- linux-2.4.18-18.8.0-l4/include/linux/fs.h~vfs_intent-2.4.18-18 Sat Dec 14 06:31:22 2002
1062 +++ linux-2.4.18-18.8.0-l4-root/include/linux/fs.h Sat Dec 14 06:33:11 2002
1063 @@ -576,6 +576,7 @@ struct file {
1065 /* needed for tty driver, and maybe others */
1067 + struct lookup_intent *f_intent;
1069 /* preallocated helper kiobuf to speedup O_DIRECT */
1070 struct kiobuf *f_iobuf;
1071 @@ -836,7 +837,9 @@ extern int vfs_symlink(struct inode *, s
1072 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1073 extern int vfs_rmdir(struct inode *, struct dentry *);
1074 extern int vfs_unlink(struct inode *, struct dentry *);
1075 -extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
1076 +int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1077 + struct inode *new_dir, struct dentry *new_dentry,
1078 + struct lookup_intent *it);
1082 @@ -897,6 +900,7 @@ struct file_operations {
1083 struct inode_operations {
1084 int (*create) (struct inode *,struct dentry *,int);
1085 struct dentry * (*lookup) (struct inode *,struct dentry *);
1086 + struct dentry * (*lookup2) (struct inode *,struct dentry *, struct lookup_intent *);
1087 int (*link) (struct dentry *,struct inode *,struct dentry *);
1088 int (*unlink) (struct inode *,struct dentry *);
1089 int (*symlink) (struct inode *,struct dentry *,const char *);
1090 @@ -907,6 +911,8 @@ struct inode_operations {
1091 struct inode *, struct dentry *);
1092 int (*readlink) (struct dentry *, char *,int);
1093 int (*follow_link) (struct dentry *, struct nameidata *);
1094 + int (*follow_link2) (struct dentry *, struct nameidata *,
1095 + struct lookup_intent *it);
1096 void (*truncate) (struct inode *);
1097 int (*permission) (struct inode *, int);
1098 int (*revalidate) (struct dentry *);
1099 @@ -1381,6 +1387,7 @@ typedef int (*read_actor_t)(read_descrip
1100 extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
1102 extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
1103 +extern int FASTCALL(__user_walk_it(const char *, unsigned, struct nameidata *, struct lookup_intent *it));
1104 extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
1105 extern int FASTCALL(path_walk(const char *, struct nameidata *));
1106 extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
1107 @@ -1392,6 +1399,8 @@ extern struct dentry * lookup_one_len(co
1108 extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
1109 #define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
1110 #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
1111 +#define user_path_walk_it(name,nd,it) __user_walk_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd, it)
1112 +#define user_path_walk_link_it(name,nd,it) __user_walk_it(name, LOOKUP_POSITIVE, nd, it)
1114 extern void inode_init_once(struct inode *);
1115 extern void iput(struct inode *);
1116 @@ -1492,6 +1501,8 @@ extern struct file_operations generic_ro
1118 extern int vfs_readlink(struct dentry *, char *, int, const char *);
1119 extern int vfs_follow_link(struct nameidata *, const char *);
1120 +extern int vfs_follow_link_it(struct nameidata *, const char *,
1121 + struct lookup_intent *it);
1122 extern int page_readlink(struct dentry *, char *, int);
1123 extern int page_follow_link(struct dentry *, struct nameidata *);
1124 extern struct inode_operations page_symlink_inode_operations;
1125 --- linux-2.4.18-18.8.0-l4/kernel/ksyms.c~vfs_intent-2.4.18-18 Sat Dec 14 06:31:22 2002
1126 +++ linux-2.4.18-18.8.0-l4-root/kernel/ksyms.c Sat Dec 14 06:31:22 2002
1127 @@ -293,6 +293,7 @@ EXPORT_SYMBOL(read_cache_page);
1128 EXPORT_SYMBOL(set_page_dirty);
1129 EXPORT_SYMBOL(vfs_readlink);
1130 EXPORT_SYMBOL(vfs_follow_link);
1131 +EXPORT_SYMBOL(vfs_follow_link_it);
1132 EXPORT_SYMBOL(page_readlink);
1133 EXPORT_SYMBOL(page_follow_link);
1134 EXPORT_SYMBOL(page_symlink_inode_operations);