6 --- linux-2.4.18-17.8.0/fs/dcache.c~vfs_intent 2002-12-06 14:52:31.000000000 -0800
7 +++ linux-2.4.18-17.8.0-zab/fs/dcache.c 2002-12-06 14:52:31.000000000 -0800
8 @@ -150,6 +150,8 @@ repeat:
10 list_del_init(&dentry->d_hash);
15 struct dentry *parent;
16 list_del(&dentry->d_child);
17 @@ -645,6 +647,7 @@ struct dentry * d_alloc(struct dentry *
18 dentry->d_fsdata = NULL;
19 dentry->d_extra_attributes = NULL;
20 dentry->d_mounted = 0;
21 + dentry->d_it = NULL;
22 INIT_LIST_HEAD(&dentry->d_hash);
23 INIT_LIST_HEAD(&dentry->d_lru);
24 INIT_LIST_HEAD(&dentry->d_subdirs);
25 --- linux-2.4.18-17.8.0/fs/namei.c~vfs_intent 2002-12-06 14:52:31.000000000 -0800
26 +++ linux-2.4.18-17.8.0-zab/fs/namei.c 2002-12-06 14:52:31.000000000 -0800
35 * XEmacs seems to be relying on it...
38 +void intent_release(struct dentry *de, struct lookup_intent *it)
40 + if (it && de->d_op && de->d_op->d_intent_release)
41 + de->d_op->d_intent_release(de, it);
46 /* In order to reduce some races, while at the same time doing additional
47 * checking and hopefully speeding things up, we copy filenames to the
48 * kernel data space before using them..
49 @@ -260,10 +271,19 @@ void path_release(struct nameidata *nd)
50 * Internal lookup() using the new generic dcache.
53 -static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name, int flags)
54 +static struct dentry *cached_lookup(struct dentry *parent, struct qstr *name,
55 + int flags, struct lookup_intent *it)
57 struct dentry * dentry = d_lookup(parent, name);
59 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate2) {
60 + if (!dentry->d_op->d_revalidate2(dentry, flags, it) &&
61 + !d_invalidate(dentry)) {
67 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
68 if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) {
70 @@ -281,7 +301,8 @@ static struct dentry * cached_lookup(str
71 * make sure that nobody added the entry to the dcache in the meantime..
74 -static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, int flags)
75 +static struct dentry *real_lookup(struct dentry *parent, struct qstr *name,
76 + int flags, struct lookup_intent *it)
78 struct dentry * result;
79 struct inode *dir = parent->d_inode;
80 @@ -300,6 +321,9 @@ static struct dentry * real_lookup(struc
81 result = ERR_PTR(-ENOMEM);
84 + if (dir->i_op->lookup2)
85 + result = dir->i_op->lookup2(dir, dentry, it);
87 result = dir->i_op->lookup(dir, dentry);
90 @@ -321,6 +345,12 @@ static struct dentry * real_lookup(struc
92 result = ERR_PTR(-ENOENT);
94 + } else if (result->d_op && result->d_op->d_revalidate2) {
95 + if (!result->d_op->d_revalidate2(result, flags, it) &&
96 + !d_invalidate(result)) {
98 + result = ERR_PTR(-ENOENT);
103 @@ -334,7 +364,8 @@ int max_recursive_link = 5;
104 * Without that kind of total limit, nasty chains of consecutive
105 * symlinks can cause almost arbitrarily long lookups.
107 -static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
108 +static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd,
109 + struct lookup_intent *it)
112 if (current->link_count >= max_recursive_link)
113 @@ -348,10 +379,14 @@ static inline int do_follow_link(struct
114 current->link_count++;
115 current->total_link_count++;
116 UPDATE_ATIME(dentry->d_inode);
117 - err = dentry->d_inode->i_op->follow_link(dentry, nd);
118 + if (dentry->d_inode->i_op->follow_link2)
119 + err = dentry->d_inode->i_op->follow_link2(dentry, nd, it);
121 + err = dentry->d_inode->i_op->follow_link(dentry, nd);
122 current->link_count--;
125 + intent_release(dentry, it);
129 @@ -449,7 +484,8 @@ static inline void follow_dotdot(struct
131 * We expect 'base' to be positive and a directory.
133 -int link_path_walk(const char * name, struct nameidata *nd)
134 +int link_path_walk_it(const char *name, struct nameidata *nd,
135 + struct lookup_intent *it)
137 struct dentry *dentry;
139 @@ -526,12 +562,12 @@ int link_path_walk(const char * name, st
142 /* This does the actual lookups.. */
143 - dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
144 + dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE, NULL);
146 err = -EWOULDBLOCKIO;
149 - dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
150 + dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE, NULL);
151 err = PTR_ERR(dentry);
154 @@ -548,8 +584,8 @@ int link_path_walk(const char * name, st
158 - if (inode->i_op->follow_link) {
159 - err = do_follow_link(dentry, nd);
160 + if (inode->i_op->follow_link || inode->i_op->follow_link2) {
161 + err = do_follow_link(dentry, nd, NULL);
165 @@ -565,7 +601,7 @@ int link_path_walk(const char * name, st
169 - if (!inode->i_op->lookup)
170 + if (!inode->i_op->lookup && !inode->i_op->lookup2)
173 /* here ends the main loop */
174 @@ -592,12 +628,12 @@ last_component:
178 - dentry = cached_lookup(nd->dentry, &this, 0);
179 + dentry = cached_lookup(nd->dentry, &this, 0, it);
181 err = -EWOULDBLOCKIO;
184 - dentry = real_lookup(nd->dentry, &this, 0);
185 + dentry = real_lookup(nd->dentry, &this, 0, it);
186 err = PTR_ERR(dentry);
189 @@ -606,8 +642,10 @@ last_component:
191 inode = dentry->d_inode;
192 if ((lookup_flags & LOOKUP_FOLLOW)
193 - && inode && inode->i_op && inode->i_op->follow_link) {
194 - err = do_follow_link(dentry, nd);
195 + && inode && inode->i_op &&
196 + (inode->i_op->follow_link ||
197 + inode->i_op->follow_link2)) {
198 + err = do_follow_link(dentry, nd, it);
202 @@ -621,7 +659,8 @@ last_component:
204 if (lookup_flags & LOOKUP_DIRECTORY) {
206 - if (!inode->i_op || !inode->i_op->lookup)
207 + if (!inode->i_op || (!inode->i_op->lookup &&
208 + !inode->i_op->lookup2))
212 @@ -663,10 +702,21 @@ return_err:
216 +int link_path_walk(const char * name, struct nameidata *nd)
218 + return link_path_walk_it(name, nd, NULL);
221 +int path_walk_it(const char * name, struct nameidata *nd, struct lookup_intent *it)
223 + current->total_link_count = 0;
224 + return link_path_walk_it(name, nd, it);
227 int path_walk(const char * name, struct nameidata *nd)
229 current->total_link_count = 0;
230 - return link_path_walk(name, nd);
231 + return link_path_walk_it(name, nd, NULL);
235 @@ -751,6 +801,17 @@ walk_init_root(const char *name, struct
239 +int path_lookup_it(const char *path, unsigned flags, struct nameidata *nd,
240 + struct lookup_intent *it)
243 + if (path_init(path, flags, nd))
244 + error = path_walk_it(path, nd, it);
250 int path_lookup(const char *path, unsigned flags, struct nameidata *nd)
253 @@ -779,7 +840,8 @@ int path_init(const char *name, unsigned
254 * needs parent already locked. Doesn't follow mounts.
257 -struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
258 +struct dentry * lookup_hash_it(struct qstr *name, struct dentry * base,
259 + struct lookup_intent *it)
261 struct dentry * dentry;
263 @@ -802,13 +864,16 @@ struct dentry * lookup_hash(struct qstr
267 - dentry = cached_lookup(base, name, 0);
268 + dentry = cached_lookup(base, name, 0, it);
270 struct dentry *new = d_alloc(base, name);
271 dentry = ERR_PTR(-ENOMEM);
275 + if (inode->i_op->lookup2)
276 + dentry = inode->i_op->lookup2(inode, new, it);
278 dentry = inode->i_op->lookup(inode, new);
281 @@ -820,6 +885,12 @@ out:
285 +struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
287 + return lookup_hash_it(name, base, NULL);
292 struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
294 @@ -841,7 +912,7 @@ struct dentry * lookup_one_len(const cha
296 this.hash = end_name_hash(hash);
298 - return lookup_hash(&this, base);
299 + return lookup_hash_it(&this, base, NULL);
301 return ERR_PTR(-EACCES);
303 @@ -872,6 +943,23 @@ int __user_walk(const char *name, unsign
307 +int __user_walk_it(const char *name, unsigned flags, struct nameidata *nd,
308 + struct lookup_intent *it)
313 + tmp = getname(name);
314 + err = PTR_ERR(tmp);
315 + if (!IS_ERR(tmp)) {
317 + if (path_init(tmp, flags, nd))
318 + err = path_walk_it(tmp, nd, it);
325 * It's inline, so penalty for filesystems that don't use sticky bit is
327 @@ -1010,7 +1098,8 @@ exit_lock:
328 * for symlinks (where the permissions are checked later).
331 -int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
332 +int open_namei_it(const char *pathname, int flag, int mode,
333 + struct nameidata *nd, struct lookup_intent *it)
335 int acc_mode, error = 0;
337 @@ -1024,7 +1113,7 @@ int open_namei(const char * pathname, in
338 * The simplest case - just a plain lookup.
340 if (!(flag & O_CREAT)) {
341 - error = path_lookup(pathname, lookup_flags(flag), nd);
342 + error = path_lookup_it(pathname, lookup_flags(flag), nd, it);
346 @@ -1034,6 +1123,10 @@ int open_namei(const char * pathname, in
348 * Create - we need to know the parent.
351 + it->it_mode = mode;
352 + it->it_op |= IT_CREAT;
354 error = path_lookup(pathname, LOOKUP_PARENT, nd);
357 @@ -1049,7 +1142,7 @@ int open_namei(const char * pathname, in
360 down(&dir->d_inode->i_sem);
361 - dentry = lookup_hash(&nd->last, nd->dentry);
362 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
365 error = PTR_ERR(dentry);
366 @@ -1058,6 +1151,7 @@ do_last:
370 + it->it_mode = mode;
371 /* Negative dentry, just create the file */
372 if (!dentry->d_inode) {
373 error = vfs_create(dir->d_inode, dentry,
374 @@ -1091,7 +1185,8 @@ do_last:
376 if (!dentry->d_inode)
378 - if (dentry->d_inode->i_op && dentry->d_inode->i_op->follow_link)
379 + if (dentry->d_inode->i_op && (dentry->d_inode->i_op->follow_link ||
380 + dentry->d_inode->i_op->follow_link2))
384 @@ -1177,8 +1272,10 @@ ok:
388 + intent_release(dentry, it);
391 + intent_release(nd->dentry, it);
395 @@ -1197,7 +1294,12 @@ do_link:
396 * are done. Procfs-like symlinks just set LAST_BIND.
398 UPDATE_ATIME(dentry->d_inode);
399 - error = dentry->d_inode->i_op->follow_link(dentry, nd);
400 + if (dentry->d_inode->i_op->follow_link2)
401 + error = dentry->d_inode->i_op->follow_link2(dentry, nd, it);
403 + error = dentry->d_inode->i_op->follow_link(dentry, nd);
405 + intent_release(dentry, it);
409 @@ -1219,13 +1321,20 @@ do_link:
412 down(&dir->d_inode->i_sem);
413 - dentry = lookup_hash(&nd->last, nd->dentry);
414 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
415 putname(nd->last.name);
419 +int open_namei(const char *pathname, int flag, int mode, struct nameidata *nd)
421 + return open_namei_it(pathname, flag, mode, nd, NULL);
426 -static struct dentry *lookup_create(struct nameidata *nd, int is_dir)
427 +static struct dentry *lookup_create(struct nameidata *nd, int is_dir,
428 + struct lookup_intent *it)
430 struct dentry *dentry;
432 @@ -1233,7 +1342,7 @@ static struct dentry *lookup_create(stru
433 dentry = ERR_PTR(-EEXIST);
434 if (nd->last_type != LAST_NORM)
436 - dentry = lookup_hash(&nd->last, nd->dentry);
437 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
440 if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
441 @@ -1279,6 +1388,7 @@ asmlinkage long sys_mknod(const char * f
443 struct dentry * dentry;
445 + struct lookup_intent it = { .it_op = IT_MKNOD, .it_mode = mode };
449 @@ -1289,7 +1399,7 @@ asmlinkage long sys_mknod(const char * f
450 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
453 - dentry = lookup_create(&nd, 0);
454 + dentry = lookup_create(&nd, 0, &it);
455 error = PTR_ERR(dentry);
457 mode &= ~current->fs->umask;
458 @@ -1307,6 +1417,7 @@ asmlinkage long sys_mknod(const char * f
462 + intent_release(dentry, &it);
465 up(&nd.dentry->d_inode->i_sem);
466 @@ -1347,6 +1458,7 @@ asmlinkage long sys_mkdir(const char * p
470 + struct lookup_intent it = { .it_op = IT_MKDIR, .it_mode = mode };
472 tmp = getname(pathname);
473 error = PTR_ERR(tmp);
474 @@ -1357,11 +1469,12 @@ asmlinkage long sys_mkdir(const char * p
475 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
478 - dentry = lookup_create(&nd, 1);
479 + dentry = lookup_create(&nd, 1, &it);
480 error = PTR_ERR(dentry);
481 if (!IS_ERR(dentry)) {
482 error = vfs_mkdir(nd.dentry->d_inode, dentry,
483 mode & ~current->fs->umask);
484 + intent_release(dentry, &it);
487 up(&nd.dentry->d_inode->i_sem);
488 @@ -1445,6 +1558,7 @@ asmlinkage long sys_rmdir(const char * p
490 struct dentry *dentry;
492 + struct lookup_intent it = { .it_op = IT_RMDIR };
494 name = getname(pathname);
496 @@ -1466,10 +1580,11 @@ asmlinkage long sys_rmdir(const char * p
499 down(&nd.dentry->d_inode->i_sem);
500 - dentry = lookup_hash(&nd.last, nd.dentry);
501 + dentry = lookup_hash_it(&nd.last, nd.dentry, &it);
502 error = PTR_ERR(dentry);
503 if (!IS_ERR(dentry)) {
504 error = vfs_rmdir(nd.dentry->d_inode, dentry);
505 + intent_release(dentry, &it);
508 up(&nd.dentry->d_inode->i_sem);
509 @@ -1513,6 +1628,7 @@ asmlinkage long sys_unlink(const char *
511 struct dentry *dentry;
513 + struct lookup_intent it = { .it_op = IT_UNLINK };
515 name = getname(pathname);
517 @@ -1525,7 +1641,7 @@ asmlinkage long sys_unlink(const char *
518 if (nd.last_type != LAST_NORM)
520 down(&nd.dentry->d_inode->i_sem);
521 - dentry = lookup_hash(&nd.last, nd.dentry);
522 + dentry = lookup_hash_it(&nd.last, nd.dentry, &it);
523 error = PTR_ERR(dentry);
524 if (!IS_ERR(dentry)) {
525 /* Why not before? Because we want correct error value */
526 @@ -1533,6 +1649,7 @@ asmlinkage long sys_unlink(const char *
528 error = vfs_unlink(nd.dentry->d_inode, dentry);
530 + intent_release(dentry, &it);
533 up(&nd.dentry->d_inode->i_sem);
534 @@ -1579,6 +1696,7 @@ asmlinkage long sys_symlink(const char *
538 + struct lookup_intent it = { .it_op = IT_SYMLINK };
540 from = getname(oldname);
542 @@ -1592,10 +1710,12 @@ asmlinkage long sys_symlink(const char *
543 error = path_lookup(to, LOOKUP_PARENT, &nd);
546 - dentry = lookup_create(&nd, 0);
548 + dentry = lookup_create(&nd, 0, &it);
549 error = PTR_ERR(dentry);
550 if (!IS_ERR(dentry)) {
551 error = vfs_symlink(nd.dentry->d_inode, dentry, from);
552 + intent_release(dentry, &it);
555 up(&nd.dentry->d_inode->i_sem);
556 @@ -1660,6 +1780,7 @@ asmlinkage long sys_link(const char * ol
560 + struct lookup_intent it = { .it_op = IT_LINK };
562 to = getname(newname);
564 @@ -1667,7 +1788,7 @@ asmlinkage long sys_link(const char * ol
565 struct dentry *new_dentry;
566 struct nameidata nd, old_nd;
568 - error = __user_walk(oldname, LOOKUP_POSITIVE, &old_nd);
569 + error = __user_walk_it(oldname, LOOKUP_POSITIVE, &old_nd, &it);
572 error = path_lookup(to, LOOKUP_PARENT, &nd);
573 @@ -1676,10 +1797,12 @@ asmlinkage long sys_link(const char * ol
575 if (old_nd.mnt != nd.mnt)
577 - new_dentry = lookup_create(&nd, 0);
578 + it.it_op = IT_LINK2;
579 + new_dentry = lookup_create(&nd, 0, &it);
580 error = PTR_ERR(new_dentry);
581 if (!IS_ERR(new_dentry)) {
582 error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
583 + intent_release(new_dentry, &it);
586 up(&nd.dentry->d_inode->i_sem);
587 @@ -1720,7 +1843,8 @@ exit:
590 int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
591 - struct inode *new_dir, struct dentry *new_dentry)
592 + struct inode *new_dir, struct dentry *new_dentry,
593 + struct lookup_intent *it)
596 struct inode *target;
597 @@ -1778,6 +1902,7 @@ int vfs_rename_dir(struct inode *old_dir
600 error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
601 + intent_release(new_dentry, it);
604 target->i_flags |= S_DEAD;
605 @@ -1799,7 +1924,8 @@ out_unlock:
608 int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
609 - struct inode *new_dir, struct dentry *new_dentry)
610 + struct inode *new_dir, struct dentry *new_dentry,
611 + struct lookup_intent *it)
615 @@ -1830,6 +1956,7 @@ int vfs_rename_other(struct inode *old_d
618 error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
619 + intent_release(new_dentry, it);
620 double_up(&old_dir->i_zombie, &new_dir->i_zombie);
623 @@ -1841,13 +1968,14 @@ int vfs_rename_other(struct inode *old_d
626 int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
627 - struct inode *new_dir, struct dentry *new_dentry)
628 + struct inode *new_dir, struct dentry *new_dentry,
629 + struct lookup_intent *it)
632 if (S_ISDIR(old_dentry->d_inode->i_mode))
633 - error = vfs_rename_dir(old_dir,old_dentry,new_dir,new_dentry);
634 + error = vfs_rename_dir(old_dir,old_dentry,new_dir,new_dentry,it);
636 - error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry);
637 + error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry,it);
639 if (old_dir == new_dir)
640 inode_dir_notify(old_dir, DN_RENAME);
641 @@ -1864,6 +1992,7 @@ static inline int do_rename(const char *
643 struct dentry * old_dir, * new_dir;
644 struct dentry * old_dentry, *new_dentry;
645 + struct lookup_intent it = { .it_op = IT_RENAME };
646 struct nameidata oldnd, newnd;
648 error = path_lookup(oldname, LOOKUP_PARENT, &oldnd);
649 @@ -1889,7 +2018,7 @@ static inline int do_rename(const char *
651 double_lock(new_dir, old_dir);
653 - old_dentry = lookup_hash(&oldnd.last, old_dir);
654 + old_dentry = lookup_hash_it(&oldnd.last, old_dir, &it);
655 error = PTR_ERR(old_dentry);
656 if (IS_ERR(old_dentry))
658 @@ -1905,18 +2034,21 @@ static inline int do_rename(const char *
659 if (newnd.last.name[newnd.last.len])
662 - new_dentry = lookup_hash(&newnd.last, new_dir);
663 + it.it_op = IT_RENAME2;
664 + new_dentry = lookup_hash_it(&newnd.last, new_dir, &it);
665 error = PTR_ERR(new_dentry);
666 if (IS_ERR(new_dentry))
670 error = vfs_rename(old_dir->d_inode, old_dentry,
671 - new_dir->d_inode, new_dentry);
672 + new_dir->d_inode, new_dentry, &it);
675 + intent_release(new_dentry, &it);
678 + intent_release(old_dentry, &it);
681 double_up(&new_dir->d_inode->i_sem, &old_dir->d_inode->i_sem);
682 @@ -1965,7 +2097,8 @@ out:
686 -__vfs_follow_link(struct nameidata *nd, const char *link)
687 +__vfs_follow_link(struct nameidata *nd, const char *link,
688 + struct lookup_intent *it)
692 @@ -1978,7 +2111,7 @@ __vfs_follow_link(struct nameidata *nd,
693 /* weird __emul_prefix() stuff did it */
696 - res = link_path_walk(link, nd);
697 + res = link_path_walk_it(link, nd, it);
699 if (current->link_count || res || nd->last_type!=LAST_NORM)
701 @@ -2000,7 +2133,13 @@ fail:
703 int vfs_follow_link(struct nameidata *nd, const char *link)
705 - return __vfs_follow_link(nd, link);
706 + return __vfs_follow_link(nd, link, NULL);
709 +int vfs_follow_link_it(struct nameidata *nd, const char *link,
710 + struct lookup_intent *it)
712 + return __vfs_follow_link(nd, link, it);
715 /* get the link contents into pagecache */
716 @@ -2042,7 +2181,7 @@ int page_follow_link(struct dentry *dent
718 struct page *page = NULL;
719 char *s = page_getlink(dentry, &page);
720 - int res = __vfs_follow_link(nd, s);
721 + int res = __vfs_follow_link(nd, s, NULL);
724 page_cache_release(page);
725 --- linux-2.4.18-17.8.0/fs/nfsd/vfs.c~vfs_intent 2002-12-06 14:52:31.000000000 -0800
726 +++ linux-2.4.18-17.8.0-zab/fs/nfsd/vfs.c 2002-12-06 14:52:31.000000000 -0800
727 @@ -1298,7 +1298,7 @@ nfsd_rename(struct svc_rqst *rqstp, stru
731 - err = vfs_rename(fdir, odentry, tdir, ndentry);
732 + err = vfs_rename(fdir, odentry, tdir, ndentry, NULL);
734 if (!err && EX_ISSYNC(tfhp->fh_export)) {
735 nfsd_sync_dir(tdentry);
736 --- linux-2.4.18-17.8.0/fs/open.c~vfs_intent 2002-12-06 14:52:31.000000000 -0800
737 +++ linux-2.4.18-17.8.0-zab/fs/open.c 2002-12-06 14:52:31.000000000 -0800
739 #include <asm/uaccess.h>
741 #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
742 +extern int path_walk_it(const char *name, struct nameidata *nd,
743 + struct lookup_intent *it);
744 +extern void intent_release(struct dentry *de, struct lookup_intent *it);
746 int vfs_statfs(struct super_block *sb, struct statfs *buf)
748 @@ -118,12 +121,13 @@ static inline long do_sys_truncate(const
750 struct inode * inode;
752 + struct lookup_intent it = { .it_op = IT_SETATTR };
755 if (length < 0) /* sorry, but loff_t says... */
758 - error = user_path_walk(path, &nd);
759 + error = user_path_walk_it(path, &nd, &it);
762 inode = nd.dentry->d_inode;
763 @@ -168,6 +172,7 @@ static inline long do_sys_truncate(const
764 put_write_access(inode);
767 + intent_release(nd.dentry, &it);
771 @@ -259,8 +264,9 @@ asmlinkage long sys_utime(char * filenam
773 struct inode * inode;
774 struct iattr newattrs;
775 + struct lookup_intent it = { .it_op = IT_SETATTR };
777 - error = user_path_walk(filename, &nd);
778 + error = user_path_walk_it(filename, &nd, &it);
781 inode = nd.dentry->d_inode;
782 @@ -286,6 +292,7 @@ asmlinkage long sys_utime(char * filenam
784 error = notify_change(nd.dentry, &newattrs);
786 + intent_release(nd.dentry, &it);
790 @@ -303,8 +310,9 @@ asmlinkage long sys_utimes(char * filena
792 struct inode * inode;
793 struct iattr newattrs;
794 + struct lookup_intent it = { .it_op = IT_SETATTR };
796 - error = user_path_walk(filename, &nd);
797 + error = user_path_walk_it(filename, &nd, &it);
801 @@ -331,6 +339,7 @@ asmlinkage long sys_utimes(char * filena
803 error = notify_change(nd.dentry, &newattrs);
805 + intent_release(nd.dentry, &it);
809 @@ -347,6 +356,7 @@ asmlinkage long sys_access(const char *
810 int old_fsuid, old_fsgid;
811 kernel_cap_t old_cap;
813 + struct lookup_intent it = { .it_op = IT_GETATTR };
815 if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
817 @@ -364,13 +374,14 @@ asmlinkage long sys_access(const char *
819 current->cap_effective = current->cap_permitted;
821 - res = user_path_walk(filename, &nd);
822 + res = user_path_walk_it(filename, &nd, &it);
824 res = permission(nd.dentry->d_inode, mode);
825 /* SuS v2 requires we report a read only fs too */
826 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
827 && !special_file(nd.dentry->d_inode->i_mode))
829 + intent_release(nd.dentry, &it);
833 @@ -385,8 +396,11 @@ asmlinkage long sys_chdir(const char * f
837 + struct lookup_intent it = { .it_op = IT_GETATTR };
839 - error = __user_walk(filename,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd);
840 + error = __user_walk_it(filename,
841 + LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,
846 @@ -397,6 +411,7 @@ asmlinkage long sys_chdir(const char * f
847 set_fs_pwd(current->fs, nd.mnt, nd.dentry);
850 + intent_release(nd.dentry, &it);
854 @@ -436,9 +451,10 @@ asmlinkage long sys_chroot(const char *
858 + struct lookup_intent it = { .it_op = IT_GETATTR };
860 - error = __user_walk(filename, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
861 - LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
862 + error = __user_walk_it(filename, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
863 + LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd, &it);
867 @@ -454,6 +470,7 @@ asmlinkage long sys_chroot(const char *
871 + intent_release(nd.dentry, &it);
875 @@ -498,8 +515,9 @@ asmlinkage long sys_chmod(const char * f
876 struct inode * inode;
878 struct iattr newattrs;
879 + struct lookup_intent it = { .it_op = IT_SETATTR };
881 - error = user_path_walk(filename, &nd);
882 + error = user_path_walk_it(filename, &nd, &it);
885 inode = nd.dentry->d_inode;
886 @@ -519,6 +537,7 @@ asmlinkage long sys_chmod(const char * f
887 error = notify_change(nd.dentry, &newattrs);
890 + intent_release(nd.dentry, &it);
894 @@ -588,10 +607,12 @@ asmlinkage long sys_chown(const char * f
898 + struct lookup_intent it = { .it_op = IT_SETATTR };
900 - error = user_path_walk(filename, &nd);
901 + error = user_path_walk_it(filename, &nd, &it);
903 error = chown_common(nd.dentry, user, group);
904 + intent_release(nd.dentry, &it);
908 @@ -601,10 +622,12 @@ asmlinkage long sys_lchown(const char *
912 + struct lookup_intent it = { .it_op = IT_SETATTR };
914 - error = user_path_walk_link(filename, &nd);
915 + error = user_path_walk_link_it(filename, &nd, &it);
917 error = chown_common(nd.dentry, user, group);
918 + intent_release(nd.dentry, &it);
922 @@ -638,10 +661,16 @@ asmlinkage long sys_fchown(unsigned int
923 * for the internal routines (ie open_namei()/follow_link() etc). 00 is
926 +extern int open_namei_it(const char *filename, int namei_flags, int mode,
927 + struct nameidata *nd, struct lookup_intent *it);
928 +struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
929 + int flags, struct lookup_intent *it);
931 struct file *filp_open(const char * filename, int flags, int mode)
933 int namei_flags, error;
935 + struct lookup_intent it = { .it_op = IT_OPEN };
938 if ((namei_flags+1) & O_ACCMODE)
939 @@ -649,18 +678,19 @@ struct file *filp_open(const char * file
940 if (namei_flags & O_TRUNC)
943 - error = open_namei(filename, namei_flags, mode, &nd);
945 - return dentry_open(nd.dentry, nd.mnt, flags);
946 + error = open_namei_it(filename, namei_flags, mode, &nd, &it);
948 + return ERR_PTR(error);
950 - return ERR_PTR(error);
951 + return dentry_open_it(nd.dentry, nd.mnt, flags, &it);
954 extern ssize_t do_readahead(struct file *file, unsigned long index, unsigned long nr);
955 /* for files over a certains size it doesn't pay to do readahead on open */
956 #define READAHEAD_CUTOFF 48000
958 -struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
959 +struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
960 + int flags, struct lookup_intent *it)
964 @@ -711,6 +741,7 @@ struct file *dentry_open(struct dentry *
965 do_readahead(f, 0, (48 * 1024) >> PAGE_SHIFT);
968 + intent_release(dentry, it);
972 @@ -725,11 +756,17 @@ cleanup_all:
976 + intent_release(dentry, it);
979 return ERR_PTR(error);
982 +struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
984 + return dentry_open_it(dentry, mnt, flags, NULL);
988 * Find an empty file descriptor entry, and mark it busy.
990 --- linux-2.4.18-17.8.0/fs/stat.c~vfs_intent 2002-12-06 14:52:31.000000000 -0800
991 +++ linux-2.4.18-17.8.0-zab/fs/stat.c 2002-12-06 14:52:31.000000000 -0800
994 #include <asm/uaccess.h>
996 +extern void intent_release(struct dentry *de, struct lookup_intent *it);
998 * Revalidate the inode. This is required for proper NFS attribute caching.
1000 @@ -104,10 +105,12 @@ int vfs_stat(char *name, struct kstat *s
1002 struct nameidata nd;
1004 + struct lookup_intent it = { .it_op = IT_GETATTR };
1006 - error = user_path_walk(name, &nd);
1007 + error = user_path_walk_it(name, &nd, &it);
1009 error = do_getattr(nd.mnt, nd.dentry, stat);
1010 + intent_release(nd.dentry, &it);
1014 @@ -117,10 +120,12 @@ int vfs_lstat(char *name, struct kstat *
1016 struct nameidata nd;
1018 + struct lookup_intent it = { .it_op = IT_GETATTR };
1020 - error = user_path_walk_link(name, &nd);
1021 + error = user_path_walk_link_it(name, &nd, &it);
1023 error = do_getattr(nd.mnt, nd.dentry, stat);
1024 + intent_release(nd.dentry, &it);
1028 --- linux-2.4.18-17.8.0/include/linux/dcache.h~vfs_intent 2002-12-06 14:52:31.000000000 -0800
1029 +++ linux-2.4.18-17.8.0-zab/include/linux/dcache.h 2002-12-06 14:52:31.000000000 -0800
1031 #include <asm/atomic.h>
1032 #include <linux/mount.h>
1034 +#define IT_OPEN (1)
1035 +#define IT_CREAT (1<<1)
1036 +#define IT_MKDIR (1<<2)
1037 +#define IT_LINK (1<<3)
1038 +#define IT_LINK2 (1<<4)
1039 +#define IT_SYMLINK (1<<5)
1040 +#define IT_UNLINK (1<<6)
1041 +#define IT_RMDIR (1<<7)
1042 +#define IT_RENAME (1<<8)
1043 +#define IT_RENAME2 (1<<9)
1044 +#define IT_READDIR (1<<10)
1045 +#define IT_GETATTR (1<<11)
1046 +#define IT_SETATTR (1<<12)
1047 +#define IT_READLINK (1<<13)
1048 +#define IT_MKNOD (1<<14)
1049 +#define IT_LOOKUP (1<<15)
1051 +struct lookup_intent {
1054 + int it_disposition;
1056 + struct iattr *it_iattr;
1057 + __u64 it_lock_handle[2];
1063 * linux/include/linux/dcache.h
1065 @@ -78,6 +106,7 @@ struct dentry {
1066 unsigned long d_time; /* used by d_revalidate */
1067 struct dentry_operations *d_op;
1068 struct super_block * d_sb; /* The root of the dentry tree */
1069 + struct lookup_intent *d_it;
1070 unsigned long d_vfs_flags;
1071 void * d_fsdata; /* fs-specific data */
1072 void * d_extra_attributes; /* TUX-specific data */
1073 @@ -91,6 +120,8 @@ struct dentry_operations {
1074 int (*d_delete)(struct dentry *);
1075 void (*d_release)(struct dentry *);
1076 void (*d_iput)(struct dentry *, struct inode *);
1077 + int (*d_revalidate2)(struct dentry *, int, struct lookup_intent *);
1078 + void (*d_intent_release)(struct dentry *, struct lookup_intent *);
1081 /* the dentry parameter passed to d_hash and d_compare is the parent
1082 --- linux-2.4.18-17.8.0/include/linux/fs.h~vfs_intent 2002-12-06 14:52:31.000000000 -0800
1083 +++ linux-2.4.18-17.8.0-zab/include/linux/fs.h 2002-12-06 14:52:31.000000000 -0800
1084 @@ -576,6 +576,7 @@ struct file {
1086 /* needed for tty driver, and maybe others */
1088 + struct lookup_intent *f_intent;
1090 /* preallocated helper kiobuf to speedup O_DIRECT */
1091 struct kiobuf *f_iobuf;
1092 @@ -836,7 +837,9 @@ extern int vfs_symlink(struct inode *, s
1093 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1094 extern int vfs_rmdir(struct inode *, struct dentry *);
1095 extern int vfs_unlink(struct inode *, struct dentry *);
1096 -extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
1097 +int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1098 + struct inode *new_dir, struct dentry *new_dentry,
1099 + struct lookup_intent *it);
1103 @@ -897,6 +900,7 @@ struct file_operations {
1104 struct inode_operations {
1105 int (*create) (struct inode *,struct dentry *,int);
1106 struct dentry * (*lookup) (struct inode *,struct dentry *);
1107 + struct dentry * (*lookup2) (struct inode *,struct dentry *, struct lookup_intent *);
1108 int (*link) (struct dentry *,struct inode *,struct dentry *);
1109 int (*unlink) (struct inode *,struct dentry *);
1110 int (*symlink) (struct inode *,struct dentry *,const char *);
1111 @@ -907,6 +911,8 @@ struct inode_operations {
1112 struct inode *, struct dentry *);
1113 int (*readlink) (struct dentry *, char *,int);
1114 int (*follow_link) (struct dentry *, struct nameidata *);
1115 + int (*follow_link2) (struct dentry *, struct nameidata *,
1116 + struct lookup_intent *it);
1117 void (*truncate) (struct inode *);
1118 int (*permission) (struct inode *, int);
1119 int (*revalidate) (struct dentry *);
1120 @@ -1381,6 +1387,7 @@ typedef int (*read_actor_t)(read_descrip
1121 extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
1123 extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
1124 +extern int FASTCALL(__user_walk_it(const char *, unsigned, struct nameidata *, struct lookup_intent *it));
1125 extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
1126 extern int FASTCALL(path_walk(const char *, struct nameidata *));
1127 extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
1128 @@ -1392,6 +1399,8 @@ extern struct dentry * lookup_one_len(co
1129 extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
1130 #define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
1131 #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
1132 +#define user_path_walk_it(name,nd,it) __user_walk_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd, it)
1133 +#define user_path_walk_link_it(name,nd,it) __user_walk_it(name, LOOKUP_POSITIVE, nd, it)
1135 extern void inode_init_once(struct inode *);
1136 extern void iput(struct inode *);
1137 @@ -1492,6 +1501,8 @@ extern struct file_operations generic_ro
1139 extern int vfs_readlink(struct dentry *, char *, int, const char *);
1140 extern int vfs_follow_link(struct nameidata *, const char *);
1141 +extern int vfs_follow_link_it(struct nameidata *, const char *,
1142 + struct lookup_intent *it);
1143 extern int page_readlink(struct dentry *, char *, int);
1144 extern int page_follow_link(struct dentry *, struct nameidata *);
1145 extern struct inode_operations page_symlink_inode_operations;
1146 --- linux-2.4.18-17.8.0/kernel/ksyms.c~vfs_intent 2002-12-06 14:52:31.000000000 -0800
1147 +++ linux-2.4.18-17.8.0-zab/kernel/ksyms.c 2002-12-06 14:52:31.000000000 -0800
1148 @@ -293,6 +293,7 @@ EXPORT_SYMBOL(read_cache_page);
1149 EXPORT_SYMBOL(set_page_dirty);
1150 EXPORT_SYMBOL(vfs_readlink);
1151 EXPORT_SYMBOL(vfs_follow_link);
1152 +EXPORT_SYMBOL(vfs_follow_link_it);
1153 EXPORT_SYMBOL(page_readlink);
1154 EXPORT_SYMBOL(page_follow_link);
1155 EXPORT_SYMBOL(page_symlink_inode_operations);