2 fs/namei.c | 306 ++++++++++++++++++++++++++++++++++++++++---------
4 fs/open.c | 63 +++++++---
6 include/linux/dcache.h | 31 ++++
7 include/linux/fs.h | 22 +++
9 8 files changed, 384 insertions(+), 73 deletions(-)
11 --- linux-2.4.19-hp2_pnnl2/fs/dcache.c~vfs_intent_hp Sun Jan 19 19:04:47 2003
12 +++ linux-2.4.19-hp2_pnnl2-root/fs/dcache.c Sun Jan 19 19:04:47 2003
13 @@ -186,6 +188,13 @@ int d_invalidate(struct dentry * dentry)
14 spin_unlock(&dcache_lock);
18 + /* network invalidation by Lustre */
19 + if (dentry->d_flags & DCACHE_LUSTRE_INVALID) {
20 + spin_unlock(&dcache_lock);
25 * Check whether to do a partial shrink_dcache
26 * to get rid of unused child entries.
27 @@ -616,6 +618,7 @@ struct dentry * d_alloc(struct dentry *
29 dentry->d_fsdata = NULL;
30 dentry->d_mounted = 0;
31 + dentry->d_it = NULL;
32 INIT_LIST_HEAD(&dentry->d_hash);
33 INIT_LIST_HEAD(&dentry->d_lru);
34 INIT_LIST_HEAD(&dentry->d_subdirs);
35 --- linux-2.4.19-hp2_pnnl2/fs/namei.c~vfs_intent_hp Sun Jan 19 19:04:47 2003
36 +++ linux-2.4.19-hp2_pnnl2-root/fs/namei.c Sun Jan 19 19:35:55 2003
38 * XEmacs seems to be relying on it...
41 +void intent_release(struct dentry *de, struct lookup_intent *it)
43 + if (it && de->d_op && de->d_op->d_intent_release)
44 + de->d_op->d_intent_release(de, it);
48 /* In order to reduce some races, while at the same time doing additional
49 * checking and hopefully speeding things up, we copy filenames to the
50 * kernel data space before using them..
51 @@ -260,10 +271,19 @@ void path_release(struct nameidata *nd)
52 * Internal lookup() using the new generic dcache.
55 -static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name, int flags)
56 +static struct dentry *cached_lookup(struct dentry *parent, struct qstr *name,
57 + int flags, struct lookup_intent *it)
59 struct dentry * dentry = d_lookup(parent, name);
61 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate2) {
62 + if (!dentry->d_op->d_revalidate2(dentry, flags, it) &&
63 + !d_invalidate(dentry)) {
69 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
70 if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) {
72 @@ -281,11 +301,14 @@ static struct dentry * cached_lookup(str
73 * make sure that nobody added the entry to the dcache in the meantime..
76 -static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, int flags)
77 +static struct dentry *real_lookup(struct dentry *parent, struct qstr *name,
78 + int flags, struct lookup_intent *it)
80 struct dentry * result;
81 struct inode *dir = parent->d_inode;
87 * First re-do the cached lookup just in case it was created
88 @@ -300,6 +321,9 @@ static struct dentry * real_lookup(struc
89 result = ERR_PTR(-ENOMEM);
92 + if (dir->i_op->lookup2)
93 + result = dir->i_op->lookup2(dir, dentry, it);
95 result = dir->i_op->lookup(dir, dentry);
98 @@ -321,6 +345,12 @@ static struct dentry * real_lookup(struc
100 result = ERR_PTR(-ENOENT);
102 + } else if (result->d_op && result->d_op->d_revalidate2) {
103 + if (!result->d_op->d_revalidate2(result, flags, it) &&
104 + !d_invalidate(result)) {
111 @@ -332,7 +362,8 @@ static struct dentry * real_lookup(struc
112 * Without that kind of total limit, nasty chains of consecutive
113 * symlinks can cause almost arbitrarily long lookups.
115 -static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
116 +static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd,
117 + struct lookup_intent *it)
120 if (current->link_count >= 5)
121 @@ -346,10 +377,14 @@ static inline int do_follow_link(struct
122 current->link_count++;
123 current->total_link_count++;
124 UPDATE_ATIME(dentry->d_inode);
125 - err = dentry->d_inode->i_op->follow_link(dentry, nd);
126 + if (dentry->d_inode->i_op->follow_link2)
127 + err = dentry->d_inode->i_op->follow_link2(dentry, nd, it);
129 + err = dentry->d_inode->i_op->follow_link(dentry, nd);
130 current->link_count--;
133 + intent_release(dentry, it);
137 @@ -447,7 +482,8 @@ static inline void follow_dotdot(struct
139 * We expect 'base' to be positive and a directory.
141 -int link_path_walk(const char * name, struct nameidata *nd)
142 +int link_path_walk_it(const char *name, struct nameidata *nd,
143 + struct lookup_intent *it)
145 struct dentry *dentry;
147 @@ -520,9 +556,9 @@ int link_path_walk(const char * name, st
150 /* This does the actual lookups.. */
151 - dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
152 + dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE, NULL);
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 @@ -539,8 +575,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 @@ -556,7 +592,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 @@ -583,9 +619,9 @@ last_component:
183 - dentry = cached_lookup(nd->dentry, &this, 0);
184 + dentry = cached_lookup(nd->dentry, &this, 0, it);
186 - dentry = real_lookup(nd->dentry, &this, 0);
187 + dentry = real_lookup(nd->dentry, &this, 0, it);
188 err = PTR_ERR(dentry);
191 @@ -594,8 +630,9 @@ last_component:
193 inode = dentry->d_inode;
194 if ((lookup_flags & LOOKUP_FOLLOW)
195 - && inode && inode->i_op && inode->i_op->follow_link) {
196 - err = do_follow_link(dentry, nd);
197 + && inode && inode->i_op &&
198 + (inode->i_op->follow_link || inode->i_op->follow_link2)) {
199 + err = do_follow_link(dentry, nd, it);
203 @@ -609,7 +647,8 @@ last_component:
205 if (lookup_flags & LOOKUP_DIRECTORY) {
207 - if (!inode->i_op || !inode->i_op->lookup)
208 + if (!inode->i_op ||
209 + (!inode->i_op->lookup && !inode->i_op->lookup2))
213 @@ -646,15 +685,28 @@ out_dput:
218 + intent_release(nd->dentry, it);
224 +int link_path_walk(const char * name, struct nameidata *nd)
226 + return link_path_walk_it(name, nd, NULL);
229 +int path_walk_it(const char * name, struct nameidata *nd, struct lookup_intent *it)
231 + current->total_link_count = 0;
232 + return link_path_walk_it(name, nd, it);
235 int path_walk(const char * name, struct nameidata *nd)
237 current->total_link_count = 0;
238 - return link_path_walk(name, nd);
239 + return link_path_walk_it(name, nd, NULL);
243 @@ -757,7 +809,8 @@ int path_init(const char *name, unsigned
244 * needs parent already locked. Doesn't follow mounts.
247 -struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
248 +struct dentry * lookup_hash_it(struct qstr *name, struct dentry * base,
249 + struct lookup_intent *it)
251 struct dentry * dentry;
253 @@ -780,13 +833,16 @@ struct dentry * lookup_hash(struct qstr
257 - dentry = cached_lookup(base, name, 0);
258 + dentry = cached_lookup(base, name, 0, it);
260 struct dentry *new = d_alloc(base, name);
261 dentry = ERR_PTR(-ENOMEM);
265 + if (inode->i_op->lookup2)
266 + dentry = inode->i_op->lookup2(inode, new, it);
268 dentry = inode->i_op->lookup(inode, new);
271 @@ -798,6 +854,12 @@ out:
275 +struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
277 + return lookup_hash_it(name, base, NULL);
282 struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
284 @@ -819,7 +881,7 @@ struct dentry * lookup_one_len(const cha
286 this.hash = end_name_hash(hash);
288 - return lookup_hash(&this, base);
289 + return lookup_hash_it(&this, base, NULL);
291 return ERR_PTR(-EACCES);
293 @@ -851,6 +913,23 @@ int __user_walk(const char *name, unsign
297 +int __user_walk_it(const char *name, unsigned flags, struct nameidata *nd,
298 + struct lookup_intent *it)
303 + tmp = getname(name);
304 + err = PTR_ERR(tmp);
305 + if (!IS_ERR(tmp)) {
307 + if (path_init(tmp, flags, nd))
308 + err = path_walk_it(tmp, nd, it);
315 * It's inline, so penalty for filesystems that don't use sticky bit is
317 @@ -987,7 +1066,8 @@ exit_lock:
318 * for symlinks (where the permissions are checked later).
321 -int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
322 +int open_namei_it(const char *pathname, int flag, int mode,
323 + struct nameidata *nd, struct lookup_intent *it)
325 int acc_mode, error = 0;
327 @@ -1002,7 +1082,7 @@ int open_namei(const char * pathname, in
329 if (!(flag & O_CREAT)) {
330 if (path_init(pathname, lookup_flags(flag), nd))
331 - error = path_walk(pathname, nd);
332 + error = path_walk_it(pathname, nd, it);
336 @@ -1012,6 +1092,10 @@ int open_namei(const char * pathname, in
338 * Create - we need to know the parent.
341 + it->it_mode = mode;
342 + it->it_op |= IT_CREAT;
344 if (path_init(pathname, LOOKUP_PARENT, nd))
345 error = path_walk(pathname, nd);
347 @@ -1028,7 +1112,7 @@ int open_namei(const char * pathname, in
350 down(&dir->d_inode->i_sem);
351 - dentry = lookup_hash(&nd->last, nd->dentry);
352 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
355 error = PTR_ERR(dentry);
356 @@ -1037,6 +1121,7 @@ do_last:
360 + it->it_mode = mode;
361 /* Negative dentry, just create the file */
362 if (!dentry->d_inode) {
363 if (!IS_POSIXACL(dir->d_inode))
364 @@ -1071,7 +1156,8 @@ do_last:
366 if (!dentry->d_inode)
368 - if (dentry->d_inode->i_op && dentry->d_inode->i_op->follow_link)
369 + if (dentry->d_inode->i_op && (dentry->d_inode->i_op->follow_link ||
370 + dentry->d_inode->i_op->follow_link2))
374 @@ -1157,8 +1243,10 @@ ok:
378 + intent_release(dentry, it);
381 + intent_release(nd->dentry, it);
385 @@ -1177,7 +1265,12 @@ do_link:
386 * are done. Procfs-like symlinks just set LAST_BIND.
388 UPDATE_ATIME(dentry->d_inode);
389 - error = dentry->d_inode->i_op->follow_link(dentry, nd);
390 + if (dentry->d_inode->i_op->follow_link2)
391 + error = dentry->d_inode->i_op->follow_link2(dentry, nd, it);
393 + error = dentry->d_inode->i_op->follow_link(dentry, nd);
395 + intent_release(dentry, it);
399 @@ -1199,13 +1292,20 @@ do_link:
402 down(&dir->d_inode->i_sem);
403 - dentry = lookup_hash(&nd->last, nd->dentry);
404 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
405 putname(nd->last.name);
409 +int open_namei(const char *pathname, int flag, int mode, struct nameidata *nd)
411 + return open_namei_it(pathname, flag, mode, nd, NULL);
416 -static struct dentry *lookup_create(struct nameidata *nd, int is_dir)
417 +static struct dentry *lookup_create(struct nameidata *nd, int is_dir,
418 + struct lookup_intent *it)
420 struct dentry *dentry;
422 @@ -1213,7 +1313,7 @@ static struct dentry *lookup_create(stru
423 dentry = ERR_PTR(-EEXIST);
424 if (nd->last_type != LAST_NORM)
426 - dentry = lookup_hash(&nd->last, nd->dentry);
427 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
430 if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
431 @@ -1270,7 +1371,19 @@ asmlinkage long sys_mknod(const char * f
432 error = path_walk(tmp, &nd);
435 - dentry = lookup_create(&nd, 0);
437 + if (nd.dentry->d_inode->i_op->mknod2) {
438 + struct inode_operations *op = nd.dentry->d_inode->i_op;
439 + error = op->mknod2(nd.dentry->d_inode,
443 + /* the file system want to use normal vfs path now */
444 + if (error != -EOPNOTSUPP)
448 + dentry = lookup_create(&nd, 0, NULL);
449 error = PTR_ERR(dentry);
451 if (!IS_POSIXACL(nd.dentry->d_inode))
452 @@ -1289,6 +1402,7 @@ asmlinkage long sys_mknod(const char * f
455 up(&nd.dentry->d_inode->i_sem);
460 @@ -1340,15 +1456,25 @@ asmlinkage long sys_mkdir(const char * p
461 error = path_walk(tmp, &nd);
464 - dentry = lookup_create(&nd, 1);
465 + if (nd.dentry->d_inode->i_op->mkdir2) {
466 + struct inode_operations *op = nd.dentry->d_inode->i_op;
467 + error = op->mkdir2(nd.dentry->d_inode,
471 + /* the file system want to use normal vfs path now */
472 + if (error != -EOPNOTSUPP)
475 + dentry = lookup_create(&nd, 1, NULL);
476 error = PTR_ERR(dentry);
477 if (!IS_ERR(dentry)) {
478 - if (!IS_POSIXACL(nd.dentry->d_inode))
479 - mode &= ~current->fs->umask;
480 - error = vfs_mkdir(nd.dentry->d_inode, dentry, mode);
481 + error = vfs_mkdir(nd.dentry->d_inode, dentry,
482 + mode & ~current->fs->umask);
485 up(&nd.dentry->d_inode->i_sem);
490 @@ -1450,8 +1578,17 @@ asmlinkage long sys_rmdir(const char * p
494 + if (nd.dentry->d_inode->i_op->rmdir2) {
495 + struct inode_operations *op = nd.dentry->d_inode->i_op;
496 + error = op->rmdir2(nd.dentry->d_inode,
499 + /* the file system want to use normal vfs path now */
500 + if (error != -EOPNOTSUPP)
503 down(&nd.dentry->d_inode->i_sem);
504 - dentry = lookup_hash(&nd.last, nd.dentry);
505 + dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
506 error = PTR_ERR(dentry);
507 if (!IS_ERR(dentry)) {
508 error = vfs_rmdir(nd.dentry->d_inode, dentry);
509 @@ -1510,8 +1649,17 @@ asmlinkage long sys_unlink(const char *
511 if (nd.last_type != LAST_NORM)
513 + if (nd.dentry->d_inode->i_op->unlink2) {
514 + struct inode_operations *op = nd.dentry->d_inode->i_op;
515 + error = op->unlink2(nd.dentry->d_inode,
518 + /* the file system want to use normal vfs path now */
519 + if (error != -EOPNOTSUPP)
522 down(&nd.dentry->d_inode->i_sem);
523 - dentry = lookup_hash(&nd.last, nd.dentry);
524 + dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
525 error = PTR_ERR(dentry);
526 if (!IS_ERR(dentry)) {
527 /* Why not before? Because we want correct error value */
528 @@ -1579,15 +1729,26 @@ asmlinkage long sys_symlink(const char *
529 error = path_walk(to, &nd);
532 - dentry = lookup_create(&nd, 0);
533 + if (nd.dentry->d_inode->i_op->symlink2) {
534 + struct inode_operations *op = nd.dentry->d_inode->i_op;
535 + error = op->symlink2(nd.dentry->d_inode,
539 + /* the file system want to use normal vfs path now */
540 + if (error != -EOPNOTSUPP)
543 + dentry = lookup_create(&nd, 0, NULL);
544 error = PTR_ERR(dentry);
545 if (!IS_ERR(dentry)) {
546 error = vfs_symlink(nd.dentry->d_inode, dentry, from);
549 up(&nd.dentry->d_inode->i_sem);
557 @@ -1660,7 +1824,7 @@ asmlinkage long sys_link(const char * ol
560 if (path_init(from, LOOKUP_POSITIVE, &old_nd))
561 - error = path_walk(from, &old_nd);
562 + error = path_walk_it(from, &old_nd, NULL);
565 if (path_init(to, LOOKUP_PARENT, &nd))
566 @@ -1670,7 +1834,17 @@ asmlinkage long sys_link(const char * ol
568 if (old_nd.mnt != nd.mnt)
570 - new_dentry = lookup_create(&nd, 0);
571 + if (nd.dentry->d_inode->i_op->link2) {
572 + struct inode_operations *op = nd.dentry->d_inode->i_op;
573 + error = op->link2(old_nd.dentry->d_inode,
574 + nd.dentry->d_inode,
577 + /* the file system want to use normal vfs path now */
578 + if (error != -EOPNOTSUPP)
581 + new_dentry = lookup_create(&nd, 0, NULL);
582 error = PTR_ERR(new_dentry);
583 if (!IS_ERR(new_dentry)) {
584 error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
585 @@ -1716,7 +1892,8 @@ exit:
588 int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
589 - struct inode *new_dir, struct dentry *new_dentry)
590 + struct inode *new_dir, struct dentry *new_dentry,
591 + struct lookup_intent *it)
594 struct inode *target;
595 @@ -1753,6 +1923,7 @@ int vfs_rename_dir(struct inode *old_dir
598 error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
599 + intent_release(new_dentry, it);
602 target->i_flags |= S_DEAD;
603 @@ -1795,7 +1973,8 @@ out_unlock:
606 int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
607 - struct inode *new_dir, struct dentry *new_dentry)
608 + struct inode *new_dir, struct dentry *new_dentry,
609 + struct lookup_intent *it)
613 @@ -1826,6 +2005,7 @@ int vfs_rename_other(struct inode *old_d
616 error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
617 + intent_release(new_dentry, it);
618 double_up(&old_dir->i_zombie, &new_dir->i_zombie);
621 @@ -1837,13 +2017,14 @@ int vfs_rename_other(struct inode *old_d
624 int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
625 - struct inode *new_dir, struct dentry *new_dentry)
626 + struct inode *new_dir, struct dentry *new_dentry,
627 + struct lookup_intent *it)
630 if (S_ISDIR(old_dentry->d_inode->i_mode))
631 - error = vfs_rename_dir(old_dir,old_dentry,new_dir,new_dentry);
632 + error = vfs_rename_dir(old_dir,old_dentry,new_dir,new_dentry,it);
634 - error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry);
635 + error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry,it);
637 if (old_dir == new_dir)
638 inode_dir_notify(old_dir, DN_RENAME);
639 @@ -1886,9 +2068,23 @@ static inline int do_rename(const char *
640 if (newnd.last_type != LAST_NORM)
643 + if (old_dir->d_inode->i_op->rename2) {
645 + error = old_dir->d_inode->i_op->rename2(old_dir->d_inode,
652 + /* the file system want to use normal vfs path now */
653 + if (error != -EOPNOTSUPP)
657 double_lock(new_dir, old_dir);
659 - old_dentry = lookup_hash(&oldnd.last, old_dir);
660 + old_dentry = lookup_hash_it(&oldnd.last, old_dir, NULL);
661 error = PTR_ERR(old_dentry);
662 if (IS_ERR(old_dentry))
664 @@ -1904,14 +2100,14 @@ static inline int do_rename(const char *
665 if (newnd.last.name[newnd.last.len])
668 - new_dentry = lookup_hash(&newnd.last, new_dir);
669 + new_dentry = lookup_hash_it(&newnd.last, new_dir, NULL);
670 error = PTR_ERR(new_dentry);
671 if (IS_ERR(new_dentry))
675 error = vfs_rename(old_dir->d_inode, old_dentry,
676 - new_dir->d_inode, new_dentry);
677 + new_dir->d_inode, new_dentry, NULL);
681 @@ -1964,7 +2163,8 @@ out:
685 -__vfs_follow_link(struct nameidata *nd, const char *link)
686 +__vfs_follow_link(struct nameidata *nd, const char *link,
687 + struct lookup_intent *it)
691 @@ -1977,7 +2177,7 @@ __vfs_follow_link(struct nameidata *nd,
692 /* weird __emul_prefix() stuff did it */
695 - res = link_path_walk(link, nd);
696 + res = link_path_walk_it(link, nd, it);
698 if (current->link_count || res || nd->last_type!=LAST_NORM)
700 @@ -1999,7 +2199,13 @@ fail:
702 int vfs_follow_link(struct nameidata *nd, const char *link)
704 - return __vfs_follow_link(nd, link);
705 + return __vfs_follow_link(nd, link, NULL);
708 +int vfs_follow_link_it(struct nameidata *nd, const char *link,
709 + struct lookup_intent *it)
711 + return __vfs_follow_link(nd, link, it);
714 /* get the link contents into pagecache */
715 @@ -2041,7 +2247,7 @@ int page_follow_link(struct dentry *dent
717 struct page *page = NULL;
718 char *s = page_getlink(dentry, &page);
719 - int res = __vfs_follow_link(nd, s);
720 + int res = __vfs_follow_link(nd, s, NULL);
723 page_cache_release(page);
724 --- linux-2.4.19-hp2_pnnl2/fs/nfsd/vfs.c~vfs_intent_hp Sun Jan 19 19:04:47 2003
725 +++ linux-2.4.19-hp2_pnnl2-root/fs/nfsd/vfs.c Sun Jan 19 19:37:57 2003
726 @@ -1295,7 +1295,7 @@ nfsd_rename(struct svc_rqst *rqstp, stru
730 - err = vfs_rename(fdir, odentry, tdir, ndentry);
731 + err = vfs_rename(fdir, odentry, tdir, ndentry, NULL);
732 if (!err && EX_ISSYNC(tfhp->fh_export)) {
733 nfsd_sync_dir(tdentry);
734 nfsd_sync_dir(fdentry);
735 --- linux-2.4.19-hp2_pnnl2/fs/open.c~vfs_intent_hp Sun Jan 19 19:04:47 2003
736 +++ linux-2.4.19-hp2_pnnl2-root/fs/open.c Sun Jan 19 19:41:00 2003
738 #include <asm/uaccess.h>
740 #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
741 +extern int path_walk_it(const char *name, struct nameidata *nd,
742 + struct lookup_intent *it);
743 +extern void intent_release(struct dentry *de, struct lookup_intent *it);
745 int vfs_statfs(struct super_block *sb, struct statfs *buf)
747 @@ -118,12 +121,13 @@ static inline long do_sys_truncate(const
749 struct inode * inode;
751 + struct lookup_intent it = { .it_op = IT_TRUNC };
754 if (length < 0) /* sorry, but loff_t says... */
757 - error = user_path_walk(path, &nd);
758 + error = user_path_walk_it(path, &nd, &it);
761 inode = nd.dentry->d_inode;
762 @@ -168,6 +172,7 @@ static inline long do_sys_truncate(const
763 put_write_access(inode);
766 + intent_release(nd.dentry, &it);
770 @@ -259,8 +264,9 @@ asmlinkage long sys_utime(char * filenam
772 struct inode * inode;
773 struct iattr newattrs;
774 + struct lookup_intent it = { .it_op = IT_SETATTR };
776 - error = user_path_walk(filename, &nd);
777 + error = user_path_walk_it(filename, &nd, &it);
780 inode = nd.dentry->d_inode;
781 @@ -286,6 +292,7 @@ asmlinkage long sys_utime(char * filenam
783 error = notify_change(nd.dentry, &newattrs);
785 + intent_release(nd.dentry, &it);
789 @@ -303,8 +310,9 @@ asmlinkage long sys_utimes(char * filena
791 struct inode * inode;
792 struct iattr newattrs;
793 + struct lookup_intent it = { .it_op = IT_SETATTR };
795 - error = user_path_walk(filename, &nd);
796 + error = user_path_walk_it(filename, &nd, &it);
800 @@ -331,6 +339,7 @@ asmlinkage long sys_utimes(char * filena
802 error = notify_change(nd.dentry, &newattrs);
804 + intent_release(nd.dentry, &it);
808 @@ -347,6 +356,7 @@ asmlinkage long sys_access(const char *
809 int old_fsuid, old_fsgid;
810 kernel_cap_t old_cap;
812 + struct lookup_intent it = { .it_op = IT_GETATTR };
814 if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
816 @@ -364,13 +374,14 @@ asmlinkage long sys_access(const char *
818 current->cap_effective = current->cap_permitted;
820 - res = user_path_walk(filename, &nd);
821 + res = user_path_walk_it(filename, &nd, &it);
823 res = permission(nd.dentry->d_inode, mode);
824 /* SuS v2 requires we report a read only fs too */
825 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
826 && !special_file(nd.dentry->d_inode->i_mode))
828 + intent_release(nd.dentry, &it);
832 @@ -386,6 +397,7 @@ asmlinkage long sys_chdir(const char * f
836 + struct lookup_intent it = { .it_op = IT_GETATTR };
838 name = getname(filename);
839 error = PTR_ERR(name);
840 @@ -394,7 +406,7 @@ asmlinkage long sys_chdir(const char * f
843 if (path_init(name,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd))
844 - error = path_walk(name, &nd);
845 + error = path_walk_it(name, &nd, &it);
849 @@ -406,6 +418,7 @@ asmlinkage long sys_chdir(const char * f
850 set_fs_pwd(current->fs, nd.mnt, nd.dentry);
853 + intent_release(nd.dentry, &it);
857 @@ -446,6 +459,7 @@ asmlinkage long sys_chroot(const char *
861 + struct lookup_intent it = { .it_op = IT_GETATTR };
863 name = getname(filename);
864 error = PTR_ERR(name);
865 @@ -454,7 +468,7 @@ asmlinkage long sys_chroot(const char *
867 path_init(name, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
868 LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
869 - error = path_walk(name, &nd);
870 + error = path_walk_it(name, &nd, &it);
874 @@ -471,6 +485,7 @@ asmlinkage long sys_chroot(const char *
878 + intent_release(nd.dentry, &it);
882 @@ -515,8 +530,9 @@ asmlinkage long sys_chmod(const char * f
883 struct inode * inode;
885 struct iattr newattrs;
886 + struct lookup_intent it = { .it_op = IT_SETATTR };
888 - error = user_path_walk(filename, &nd);
889 + error = user_path_walk_it(filename, &nd, &it);
892 inode = nd.dentry->d_inode;
893 @@ -536,6 +552,7 @@ asmlinkage long sys_chmod(const char * f
894 error = notify_change(nd.dentry, &newattrs);
897 + intent_release(nd.dentry, &it);
901 @@ -605,10 +622,12 @@ asmlinkage long sys_chown(const char * f
905 + struct lookup_intent it = { .it_op = IT_SETATTR };
907 - error = user_path_walk(filename, &nd);
908 + error = user_path_walk_it(filename, &nd, &it);
910 error = chown_common(nd.dentry, user, group);
911 + intent_release(nd.dentry, &it);
915 @@ -618,10 +637,12 @@ asmlinkage long sys_lchown(const char *
919 + struct lookup_intent it = { .it_op = IT_SETATTR };
921 - error = user_path_walk_link(filename, &nd);
922 + error = user_path_walk_link_it(filename, &nd, &it);
924 error = chown_common(nd.dentry, user, group);
925 + intent_release(nd.dentry, &it);
929 @@ -655,10 +676,16 @@ asmlinkage long sys_fchown(unsigned int
930 * for the internal routines (ie open_namei()/follow_link() etc). 00 is
933 +extern int open_namei_it(const char *filename, int namei_flags, int mode,
934 + struct nameidata *nd, struct lookup_intent *it);
935 +struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
936 + int flags, struct lookup_intent *it);
938 struct file *filp_open(const char * filename, int flags, int mode)
940 int namei_flags, error;
942 + struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = flags };
945 if ((namei_flags+1) & O_ACCMODE)
946 @@ -666,14 +693,15 @@ struct file *filp_open(const char * file
947 if (namei_flags & O_TRUNC)
950 - error = open_namei(filename, namei_flags, mode, &nd);
952 - return dentry_open(nd.dentry, nd.mnt, flags);
953 + error = open_namei_it(filename, namei_flags, mode, &nd, &it);
955 + return ERR_PTR(error);
957 - return ERR_PTR(error);
958 + return dentry_open_it(nd.dentry, nd.mnt, flags, &it);
961 -struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
962 +struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
963 + int flags, struct lookup_intent *it)
967 @@ -716,6 +744,7 @@ struct file *dentry_open(struct dentry *
969 f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
971 + intent_release(dentry, it);
975 @@ -730,11 +759,17 @@ cleanup_all:
979 + intent_release(dentry, it);
982 return ERR_PTR(error);
985 +struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
987 + return dentry_open_it(dentry, mnt, flags, NULL);
991 * Find an empty file descriptor entry, and mark it busy.
993 --- linux-2.4.19-hp2_pnnl2/fs/stat.c~vfs_intent_hp Sun Jan 19 19:04:47 2003
994 +++ linux-2.4.19-hp2_pnnl2-root/fs/stat.c Sun Jan 19 19:44:51 2003
997 #include <asm/uaccess.h>
999 +extern void intent_release(struct dentry *de, struct lookup_intent *it);
1001 * Revalidate the inode. This is required for proper NFS attribute caching.
1003 @@ -135,13 +136,15 @@ static int cp_new_stat(struct inode * in
1004 asmlinkage long sys_stat(char * filename, struct __old_kernel_stat * statbuf)
1006 struct nameidata nd;
1007 + struct lookup_intent it = { .it_op = IT_GETATTR };
1010 - error = user_path_walk(filename, &nd);
1011 + error = user_path_walk_it(filename, &nd, &it);
1013 error = do_revalidate(nd.dentry);
1015 error = cp_old_stat(nd.dentry->d_inode, statbuf);
1016 + intent_release(nd.dentry, &it);
1020 @@ -151,13 +154,15 @@ asmlinkage long sys_stat(char * filename
1021 asmlinkage long sys_newstat(char * filename, struct stat * statbuf)
1023 struct nameidata nd;
1024 + struct lookup_intent it = { .it_op = IT_GETATTR };
1027 - error = user_path_walk(filename, &nd);
1028 + error = user_path_walk_it(filename, &nd, &it);
1030 error = do_revalidate(nd.dentry);
1032 error = cp_new_stat(nd.dentry->d_inode, statbuf);
1033 + intent_release(nd.dentry, &it);
1037 @@ -172,13 +177,15 @@ asmlinkage long sys_newstat(char * filen
1038 asmlinkage long sys_lstat(char * filename, struct __old_kernel_stat * statbuf)
1040 struct nameidata nd;
1041 + struct lookup_intent it = { .it_op = IT_GETATTR };
1044 - error = user_path_walk_link(filename, &nd);
1045 + error = user_path_walk_link_it(filename, &nd, &it);
1047 error = do_revalidate(nd.dentry);
1049 error = cp_old_stat(nd.dentry->d_inode, statbuf);
1050 + intent_release(nd.dentry, &it);
1054 @@ -189,13 +196,15 @@ asmlinkage long sys_lstat(char * filenam
1055 asmlinkage long sys_newlstat(char * filename, struct stat * statbuf)
1057 struct nameidata nd;
1058 + struct lookup_intent it = { .it_op = IT_GETATTR };
1061 - error = user_path_walk_link(filename, &nd);
1062 + error = user_path_walk_link_it(filename, &nd, &it);
1064 error = do_revalidate(nd.dentry);
1066 error = cp_new_stat(nd.dentry->d_inode, statbuf);
1067 + intent_release(nd.dentry, &it);
1071 @@ -247,11 +256,12 @@ asmlinkage long sys_readlink(const char
1073 struct nameidata nd;
1075 + struct lookup_intent it = { .it_op = IT_READLINK };
1080 - error = user_path_walk_link(path, &nd);
1081 + error = user_path_walk_link_it(path, &nd, &it);
1083 struct inode * inode = nd.dentry->d_inode;
1085 @@ -261,6 +271,7 @@ asmlinkage long sys_readlink(const char
1086 UPDATE_ATIME(inode);
1087 error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
1089 + intent_release(nd.dentry, &it);
1093 @@ -333,12 +344,14 @@ asmlinkage long sys_stat64(char * filena
1095 struct nameidata nd;
1097 + struct lookup_intent it = { .it_op = IT_GETATTR };
1099 - error = user_path_walk(filename, &nd);
1100 + error = user_path_walk_it(filename, &nd, &it);
1102 error = do_revalidate(nd.dentry);
1104 error = cp_new_stat64(nd.dentry->d_inode, statbuf);
1105 + intent_release(nd.dentry, &it);
1109 @@ -348,12 +361,14 @@ asmlinkage long sys_lstat64(char * filen
1111 struct nameidata nd;
1113 + struct lookup_intent it = { .it_op = IT_GETATTR };
1115 - error = user_path_walk_link(filename, &nd);
1116 + error = user_path_walk_link_it(filename, &nd, &it);
1118 error = do_revalidate(nd.dentry);
1120 error = cp_new_stat64(nd.dentry->d_inode, statbuf);
1121 + intent_release(nd.dentry, &it);
1125 --- linux-2.4.19-hp2_pnnl2/include/linux/dcache.h~vfs_intent_hp Sun Jan 19 19:04:47 2003
1126 +++ linux-2.4.19-hp2_pnnl2-root/include/linux/dcache.h Sun Jan 19 19:04:48 2003
1128 #include <asm/atomic.h>
1129 #include <linux/mount.h>
1131 +#define IT_OPEN (1)
1132 +#define IT_CREAT (1<<1)
1133 +#define IT_READDIR (1<<2)
1134 +#define IT_GETATTR (1<<3)
1135 +#define IT_SETATTR (1<<4)
1136 +#define IT_TRUNC (1<<5)
1137 +#define IT_READLINK (1<<6)
1138 +#define IT_LOOKUP (1<<7)
1140 +struct lookup_intent {
1144 + int it_disposition;
1146 + struct iattr *it_iattr;
1147 + __u64 it_lock_handle[2];
1153 * linux/include/linux/dcache.h
1155 @@ -78,6 +106,7 @@ struct dentry {
1156 unsigned long d_time; /* used by d_revalidate */
1157 struct dentry_operations *d_op;
1158 struct super_block * d_sb; /* The root of the dentry tree */
1159 + struct lookup_intent *d_it;
1160 unsigned long d_vfs_flags;
1161 void * d_fsdata; /* fs-specific data */
1162 unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */
1163 @@ -90,6 +119,8 @@ struct dentry_operations {
1164 int (*d_delete)(struct dentry *);
1165 void (*d_release)(struct dentry *);
1166 void (*d_iput)(struct dentry *, struct inode *);
1167 + int (*d_revalidate2)(struct dentry *, int, struct lookup_intent *);
1168 + void (*d_intent_release)(struct dentry *, struct lookup_intent *);
1171 /* the dentry parameter passed to d_hash and d_compare is the parent
1172 @@ -124,6 +148,7 @@ d_iput: no no yes
1173 * s_nfsd_free_path semaphore will be down
1175 #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
1176 +#define DCACHE_LUSTRE_INVALID 0x0010 /* Lustre invalidated */
1178 extern spinlock_t dcache_lock;
1180 --- linux-2.4.19-hp2_pnnl2/include/linux/fs.h~vfs_intent_hp Sun Jan 19 19:04:47 2003
1181 +++ linux-2.4.19-hp2_pnnl2-root/include/linux/fs.h Sun Jan 19 19:04:48 2003
1182 @@ -575,6 +575,7 @@ struct file {
1184 /* needed for tty driver, and maybe others */
1186 + struct lookup_intent *f_intent;
1188 /* preallocated helper kiobuf to speedup O_DIRECT */
1189 struct kiobuf *f_iobuf;
1190 @@ -815,7 +816,9 @@ extern int vfs_symlink(struct inode *, s
1191 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1192 extern int vfs_rmdir(struct inode *, struct dentry *);
1193 extern int vfs_unlink(struct inode *, struct dentry *);
1194 -extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
1195 +int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1196 + struct inode *new_dir, struct dentry *new_dentry,
1197 + struct lookup_intent *it);
1201 @@ -876,16 +879,28 @@ struct file_operations {
1202 struct inode_operations {
1203 int (*create) (struct inode *,struct dentry *,int);
1204 struct dentry * (*lookup) (struct inode *,struct dentry *);
1205 + struct dentry * (*lookup2) (struct inode *,struct dentry *, struct lookup_intent *);
1206 int (*link) (struct dentry *,struct inode *,struct dentry *);
1207 + int (*link2) (struct inode *,struct inode *, const char *, int);
1208 int (*unlink) (struct inode *,struct dentry *);
1209 + int (*unlink2) (struct inode *, const char *, int);
1210 int (*symlink) (struct inode *,struct dentry *,const char *);
1211 + int (*symlink2) (struct inode *, const char *, int, const char *);
1212 int (*mkdir) (struct inode *,struct dentry *,int);
1213 + int (*mkdir2) (struct inode *, const char *, int,int);
1214 int (*rmdir) (struct inode *,struct dentry *);
1215 + int (*rmdir2) (struct inode *, const char *, int);
1216 int (*mknod) (struct inode *,struct dentry *,int,int);
1217 + int (*mknod2) (struct inode *, const char *, int,int,int);
1218 int (*rename) (struct inode *, struct dentry *,
1219 struct inode *, struct dentry *);
1220 + int (*rename2) (struct inode *, struct inode *,
1221 + const char *oldname, int oldlen,
1222 + const char *newname, int newlen);
1223 int (*readlink) (struct dentry *, char *,int);
1224 int (*follow_link) (struct dentry *, struct nameidata *);
1225 + int (*follow_link2) (struct dentry *, struct nameidata *,
1226 + struct lookup_intent *it);
1227 void (*truncate) (struct inode *);
1228 int (*permission) (struct inode *, int);
1229 int (*revalidate) (struct dentry *);
1230 @@ -1354,6 +1369,7 @@ typedef int (*read_actor_t)(read_descrip
1231 extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
1233 extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
1234 +extern int FASTCALL(__user_walk_it(const char *, unsigned, struct nameidata *, struct lookup_intent *it));
1235 extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
1236 extern int FASTCALL(path_walk(const char *, struct nameidata *));
1237 extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
1238 @@ -1364,6 +1380,8 @@ extern struct dentry * lookup_one_len(co
1239 extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
1240 #define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
1241 #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
1242 +#define user_path_walk_it(name,nd,it) __user_walk_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd, it)
1243 +#define user_path_walk_link_it(name,nd,it) __user_walk_it(name, LOOKUP_POSITIVE, nd, it)
1245 extern void inode_init_once(struct inode *);
1246 extern void iput(struct inode *);
1247 @@ -1499,6 +1517,8 @@ extern struct file_operations generic_ro
1249 extern int vfs_readlink(struct dentry *, char *, int, const char *);
1250 extern int vfs_follow_link(struct nameidata *, const char *);
1251 +extern int vfs_follow_link_it(struct nameidata *, const char *,
1252 + struct lookup_intent *it);
1253 extern int page_readlink(struct dentry *, char *, int);
1254 extern int page_follow_link(struct dentry *, struct nameidata *);
1255 extern struct inode_operations page_symlink_inode_operations;
1256 --- linux-2.4.19-hp2_pnnl2/kernel/ksyms.c~vfs_intent_hp Sun Jan 19 19:04:47 2003
1257 +++ linux-2.4.19-hp2_pnnl2-root/kernel/ksyms.c Sun Jan 19 19:04:48 2003
1258 @@ -293,6 +293,7 @@ EXPORT_SYMBOL(read_cache_page);
1259 EXPORT_SYMBOL(set_page_dirty);
1260 EXPORT_SYMBOL(vfs_readlink);
1261 EXPORT_SYMBOL(vfs_follow_link);
1262 +EXPORT_SYMBOL(vfs_follow_link_it);
1263 EXPORT_SYMBOL(page_readlink);
1264 EXPORT_SYMBOL(page_follow_link);
1265 EXPORT_SYMBOL(page_symlink_inode_operations);