3 fs/namei.c | 324 ++++++++++++++++++++++++++++++++++++++--------
4 fs/namespace.c | 28 ++-
5 fs/open.c | 126 +++++++++++++++--
8 include/linux/dcache.h | 54 +++++++
9 include/linux/fs.h | 30 +++-
10 include/linux/fs_struct.h | 4
14 13 files changed, 538 insertions(+), 98 deletions(-)
16 --- kernel-2.4.20-6chaos_18_7/fs/exec.c~vfs_intent_2.4.20_chaos Thu Jun 19 10:06:09 2003
17 +++ kernel-2.4.20-6chaos_18_7-shaver/fs/exec.c Wed Jul 16 04:21:21 2003
18 @@ -113,8 +113,9 @@ asmlinkage long sys_uselib(const char *
22 + struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = O_RDONLY };
24 - error = user_path_walk(library, &nd);
25 + error = user_path_walk_it(library, &nd, &it);
29 @@ -126,7 +127,8 @@ asmlinkage long sys_uselib(const char *
33 - file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
34 + file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it);
35 + intent_release(&it);
36 error = PTR_ERR(file);
39 @@ -381,8 +383,9 @@ struct file *open_exec(const char *name)
43 + struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = O_RDONLY };
45 - err = path_lookup(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd);
46 + err = path_lookup_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd, &it);
49 inode = nd.dentry->d_inode;
50 @@ -394,7 +397,8 @@ struct file *open_exec(const char *name)
54 - file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
55 + file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it);
56 + intent_release(&it);
58 err = deny_write_access(file);
60 @@ -406,6 +410,7 @@ out:
64 + intent_release(&it);
68 @@ -1134,7 +1139,7 @@ int do_coredump(long signr, struct pt_re
70 if (!file->f_op->write)
72 - if (do_truncate(file->f_dentry, 0) != 0)
73 + if (do_truncate(file->f_dentry, 0, 0) != 0)
76 retval = binfmt->core_dump(signr, regs, file);
77 --- kernel-2.4.20-6chaos_18_7/fs/dcache.c~vfs_intent_2.4.20_chaos Thu May 15 20:14:24 2003
78 +++ kernel-2.4.20-6chaos_18_7-shaver/fs/dcache.c Wed Jul 16 04:21:21 2003
79 @@ -186,6 +186,13 @@ int d_invalidate(struct dentry * dentry)
80 spin_unlock(&dcache_lock);
84 + /* network invalidation by Lustre */
85 + if (dentry->d_flags & DCACHE_LUSTRE_INVALID) {
86 + spin_unlock(&dcache_lock);
91 * Check whether to do a partial shrink_dcache
92 * to get rid of unused child entries.
93 @@ -839,13 +846,19 @@ void d_delete(struct dentry * dentry)
94 * Adds a dentry to the hash according to its name.
97 -void d_rehash(struct dentry * entry)
98 +void __d_rehash(struct dentry * entry, int lock)
100 struct list_head *list = d_hash(entry->d_parent, entry->d_name.hash);
101 if (!list_empty(&entry->d_hash)) BUG();
102 - spin_lock(&dcache_lock);
103 + if (lock) spin_lock(&dcache_lock);
104 list_add(&entry->d_hash, list);
105 - spin_unlock(&dcache_lock);
106 + if (lock) spin_unlock(&dcache_lock);
108 +EXPORT_SYMBOL(__d_rehash);
110 +void d_rehash(struct dentry * entry)
112 + __d_rehash(entry, 1);
115 #define do_switch(x,y) do { \
116 --- kernel-2.4.20-6chaos_18_7/fs/namespace.c~vfs_intent_2.4.20_chaos Thu May 15 20:14:25 2003
117 +++ kernel-2.4.20-6chaos_18_7-shaver/fs/namespace.c Wed Jul 16 04:21:21 2003
118 @@ -99,6 +99,7 @@ static void detach_mnt(struct vfsmount *
120 old_nd->dentry = mnt->mnt_mountpoint;
121 old_nd->mnt = mnt->mnt_parent;
122 + UNPIN(old_nd->dentry, old_nd->mnt, 1);
123 mnt->mnt_parent = mnt;
124 mnt->mnt_mountpoint = mnt->mnt_root;
125 list_del_init(&mnt->mnt_child);
126 @@ -110,6 +111,7 @@ static void attach_mnt(struct vfsmount *
128 mnt->mnt_parent = mntget(nd->mnt);
129 mnt->mnt_mountpoint = dget(nd->dentry);
130 + PIN(nd->dentry, nd->mnt, 1);
131 list_add(&mnt->mnt_hash, mount_hashtable+hash(nd->mnt, nd->dentry));
132 list_add(&mnt->mnt_child, &nd->mnt->mnt_mounts);
133 nd->dentry->d_mounted++;
134 @@ -485,14 +487,17 @@ static int do_loopback(struct nameidata
136 struct nameidata old_nd;
137 struct vfsmount *mnt = NULL;
138 + struct lookup_intent it = { .it_op = IT_GETATTR };
139 int err = mount_is_safe(nd);
142 if (!old_name || !*old_name)
144 - err = path_lookup(old_name, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &old_nd);
146 + err = path_lookup_it(old_name, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &old_nd, &it);
148 + intent_release(&it);
152 down_write(¤t->namespace->sem);
154 @@ -515,6 +520,7 @@ static int do_loopback(struct nameidata
157 up_write(¤t->namespace->sem);
158 + intent_release(&it);
159 path_release(&old_nd);
162 @@ -698,6 +704,7 @@ long do_mount(char * dev_name, char * di
163 unsigned long flags, void *data_page)
166 + struct lookup_intent it = { .it_op = IT_GETATTR };
170 @@ -722,10 +729,11 @@ long do_mount(char * dev_name, char * di
171 flags &= ~(MS_NOSUID|MS_NOEXEC|MS_NODEV);
173 /* ... and get the mountpoint */
174 - retval = path_lookup(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd);
176 + retval = path_lookup_it(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd, &it);
178 + intent_release(&it);
182 if (flags & MS_REMOUNT)
183 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
185 @@ -736,6 +744,8 @@ long do_mount(char * dev_name, char * di
187 retval = do_add_mount(&nd, type_page, flags, mnt_flags,
188 dev_name, data_page);
190 + intent_release(&it);
194 @@ -901,6 +911,8 @@ asmlinkage long sys_pivot_root(const cha
196 struct vfsmount *tmp;
197 struct nameidata new_nd, old_nd, parent_nd, root_parent, user_nd;
198 + struct lookup_intent new_it = { .it_op = IT_GETATTR };
199 + struct lookup_intent old_it = { .it_op = IT_GETATTR };
202 if (!capable(CAP_SYS_ADMIN))
203 @@ -908,14 +920,14 @@ asmlinkage long sys_pivot_root(const cha
207 - error = __user_walk(new_root, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &new_nd);
208 + error = __user_walk_it(new_root, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &new_nd, &new_it);
212 if (!check_mnt(new_nd.mnt))
215 - error = __user_walk(put_old, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &old_nd);
216 + error = __user_walk_it(put_old, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &old_nd, &old_it);
220 @@ -970,8 +982,10 @@ out2:
221 up(&old_nd.dentry->d_inode->i_zombie);
222 up_write(¤t->namespace->sem);
223 path_release(&user_nd);
224 + intent_release(&old_it);
225 path_release(&old_nd);
227 + intent_release(&new_it);
228 path_release(&new_nd);
231 --- kernel-2.4.20-6chaos_18_7/fs/namei.c~vfs_intent_2.4.20_chaos Thu May 15 20:14:25 2003
232 +++ kernel-2.4.20-6chaos_18_7-shaver/fs/namei.c Wed Jul 16 04:21:21 2003
234 * XEmacs seems to be relying on it...
237 +void intent_release(struct lookup_intent *it)
239 + if (it && it->it_op_release)
240 + it->it_op_release(it);
244 /* In order to reduce some races, while at the same time doing additional
245 * checking and hopefully speeding things up, we copy filenames to the
246 * kernel data space before using them..
247 @@ -260,10 +267,19 @@ void path_release(struct nameidata *nd)
248 * Internal lookup() using the new generic dcache.
251 -static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name, int flags)
252 +static struct dentry *cached_lookup(struct dentry *parent, struct qstr *name,
253 + int flags, struct lookup_intent *it)
255 struct dentry * dentry = d_lookup(parent, name);
257 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
258 + if (!dentry->d_op->d_revalidate_it(dentry, flags, it) &&
259 + !d_invalidate(dentry)) {
265 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
266 if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) {
268 @@ -281,11 +297,14 @@ static struct dentry * cached_lookup(str
269 * make sure that nobody added the entry to the dcache in the meantime..
272 -static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, int flags)
273 +static struct dentry *real_lookup(struct dentry *parent, struct qstr *name,
274 + int flags, struct lookup_intent *it)
276 struct dentry * result;
277 struct inode *dir = parent->d_inode;
283 * First re-do the cached lookup just in case it was created
284 @@ -300,6 +319,9 @@ static struct dentry * real_lookup(struc
285 result = ERR_PTR(-ENOMEM);
288 + if (dir->i_op->lookup_it)
289 + result = dir->i_op->lookup_it(dir, dentry, it, flags);
291 result = dir->i_op->lookup(dir, dentry);
294 @@ -321,6 +343,12 @@ static struct dentry * real_lookup(struc
296 result = ERR_PTR(-ENOENT);
298 + } else if (result->d_op && result->d_op->d_revalidate_it) {
299 + if (!result->d_op->d_revalidate_it(result, flags, it) &&
300 + !d_invalidate(result)) {
307 @@ -334,7 +362,8 @@ int max_recursive_link = 5;
308 * Without that kind of total limit, nasty chains of consecutive
309 * symlinks can cause almost arbitrarily long lookups.
311 -static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
312 +static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd,
313 + struct lookup_intent *it)
316 if (current->link_count >= max_recursive_link)
317 @@ -348,10 +377,18 @@ static inline int do_follow_link(struct
318 current->link_count++;
319 current->total_link_count++;
320 UPDATE_ATIME(dentry->d_inode);
322 err = dentry->d_inode->i_op->follow_link(dentry, nd);
323 + if (!err && it != NULL && !(it->it_int_flags & IT_FL_FOLLOWED)) {
324 + /* vfs_follow_link was never called */
325 + intent_release(it);
329 current->link_count--;
332 + intent_release(it);
336 @@ -381,15 +418,26 @@ int follow_up(struct vfsmount **mnt, str
337 return __follow_up(mnt, dentry);
340 -static inline int __follow_down(struct vfsmount **mnt, struct dentry **dentry)
341 +static inline int __follow_down(struct vfsmount **mnt, struct dentry **dentry,
342 + struct lookup_intent *it)
344 struct vfsmount *mounted;
346 spin_lock(&dcache_lock);
347 mounted = lookup_mnt(*mnt, *dentry);
349 + int opc = 0, mode = 0;
350 *mnt = mntget(mounted);
351 spin_unlock(&dcache_lock);
354 + mode = it->it_mode;
356 + intent_release(it);
359 + it->it_mode = mode;
362 mntput(mounted->mnt_parent);
363 *dentry = dget(mounted->mnt_root);
364 @@ -401,7 +449,7 @@ static inline int __follow_down(struct v
366 int follow_down(struct vfsmount **mnt, struct dentry **dentry)
368 - return __follow_down(mnt,dentry);
369 + return __follow_down(mnt,dentry,NULL);
372 static inline void follow_dotdot(struct nameidata *nd)
373 @@ -437,7 +485,7 @@ static inline void follow_dotdot(struct
377 - while (d_mountpoint(nd->dentry) && __follow_down(&nd->mnt, &nd->dentry))
378 + while (d_mountpoint(nd->dentry) && __follow_down(&nd->mnt, &nd->dentry, NULL))
382 @@ -449,7 +497,8 @@ static inline void follow_dotdot(struct
384 * We expect 'base' to be positive and a directory.
386 -int link_path_walk(const char * name, struct nameidata *nd)
387 +int link_path_walk_it(const char *name, struct nameidata *nd,
388 + struct lookup_intent *it)
390 struct dentry *dentry;
392 @@ -526,19 +575,18 @@ int link_path_walk(const char * name, st
395 /* This does the actual lookups.. */
396 - dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
397 + dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE, NULL);
399 err = -EWOULDBLOCKIO;
402 - dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
403 + dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE, NULL);
404 err = PTR_ERR(dentry);
408 /* Check mountpoints.. */
409 - while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry))
411 + while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry, NULL));
414 inode = dentry->d_inode;
415 @@ -549,7 +597,7 @@ int link_path_walk(const char * name, st
418 if (inode->i_op->follow_link) {
419 - err = do_follow_link(dentry, nd);
420 + err = do_follow_link(dentry, nd, NULL);
424 @@ -565,7 +613,7 @@ int link_path_walk(const char * name, st
428 - if (!inode->i_op->lookup)
429 + if (!inode->i_op->lookup && !inode->i_op->lookup_it)
432 /* here ends the main loop */
433 @@ -592,22 +640,22 @@ last_component:
437 - dentry = cached_lookup(nd->dentry, &this, 0);
438 + dentry = cached_lookup(nd->dentry, &this, 0, it);
440 err = -EWOULDBLOCKIO;
443 - dentry = real_lookup(nd->dentry, &this, 0);
444 + dentry = real_lookup(nd->dentry, &this, 0, it);
445 err = PTR_ERR(dentry);
449 - while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry))
450 + while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry, it))
452 inode = dentry->d_inode;
453 if ((lookup_flags & LOOKUP_FOLLOW)
454 && inode && inode->i_op && inode->i_op->follow_link) {
455 - err = do_follow_link(dentry, nd);
456 + err = do_follow_link(dentry, nd, it);
460 @@ -621,7 +669,8 @@ last_component:
462 if (lookup_flags & LOOKUP_DIRECTORY) {
464 - if (!inode->i_op || !inode->i_op->lookup)
465 + if (!inode->i_op ||
466 + (!inode->i_op->lookup && !inode->i_op->lookup_it))
470 @@ -645,6 +694,23 @@ return_reval:
471 * Check the cached dentry for staleness.
475 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
477 + if (!dentry->d_op->d_revalidate_it(dentry, 0, it)) {
478 + struct dentry *new;
479 + err = permission(dentry->d_parent->d_inode,
483 + new = real_lookup(dentry->d_parent,
484 + &dentry->d_name, 0, NULL);
485 + d_invalidate(dentry);
488 + goto revalidate_again;
491 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
493 if (!dentry->d_op->d_revalidate(dentry, 0)) {
494 @@ -658,15 +724,28 @@ out_dput:
499 + intent_release(it);
505 +int link_path_walk(const char * name, struct nameidata *nd)
507 + return link_path_walk_it(name, nd, NULL);
510 +int path_walk_it(const char * name, struct nameidata *nd, struct lookup_intent *it)
512 + current->total_link_count = 0;
513 + return link_path_walk_it(name, nd, it);
516 int path_walk(const char * name, struct nameidata *nd)
518 current->total_link_count = 0;
519 - return link_path_walk(name, nd);
520 + return link_path_walk_it(name, nd, NULL);
524 @@ -751,6 +830,17 @@ walk_init_root(const char *name, struct
528 +int path_lookup_it(const char *path, unsigned flags, struct nameidata *nd,
529 + struct lookup_intent *it)
532 + if (path_init(path, flags, nd))
533 + error = path_walk_it(path, nd, it);
539 int path_lookup(const char *path, unsigned flags, struct nameidata *nd)
542 @@ -765,6 +855,7 @@ int path_init(const char *name, unsigned
544 nd->last_type = LAST_ROOT; /* if there are only slashes... */
548 return walk_init_root(name,nd);
549 read_lock(¤t->fs->lock);
550 @@ -779,7 +870,8 @@ int path_init(const char *name, unsigned
551 * needs parent already locked. Doesn't follow mounts.
554 -struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
555 +struct dentry * lookup_hash_it(struct qstr *name, struct dentry * base,
556 + struct lookup_intent *it)
558 struct dentry * dentry;
560 @@ -802,13 +894,16 @@ struct dentry * lookup_hash(struct qstr
564 - dentry = cached_lookup(base, name, 0);
565 + dentry = cached_lookup(base, name, 0, it);
567 struct dentry *new = d_alloc(base, name);
568 dentry = ERR_PTR(-ENOMEM);
572 + if (inode->i_op->lookup_it)
573 + dentry = inode->i_op->lookup_it(inode, new, it, 0);
575 dentry = inode->i_op->lookup(inode, new);
578 @@ -820,6 +915,12 @@ out:
582 +struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
584 + return lookup_hash_it(name, base, NULL);
589 struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
591 @@ -841,7 +942,7 @@ struct dentry * lookup_one_len(const cha
593 this.hash = end_name_hash(hash);
595 - return lookup_hash(&this, base);
596 + return lookup_hash_it(&this, base, NULL);
598 return ERR_PTR(-EACCES);
600 @@ -872,6 +973,23 @@ int __user_walk(const char *name, unsign
604 +int __user_walk_it(const char *name, unsigned flags, struct nameidata *nd,
605 + struct lookup_intent *it)
610 + tmp = getname(name);
611 + err = PTR_ERR(tmp);
612 + if (!IS_ERR(tmp)) {
614 + if (path_init(tmp, flags, nd))
615 + err = path_walk_it(tmp, nd, it);
622 * It's inline, so penalty for filesystems that don't use sticky bit is
624 @@ -969,7 +1087,8 @@ static inline int lookup_flags(unsigned
628 -int vfs_create(struct inode *dir, struct dentry *dentry, int mode)
629 +static int vfs_create_it(struct inode *dir, struct dentry *dentry, int mode,
630 + struct lookup_intent *it)
634 @@ -982,12 +1101,15 @@ int vfs_create(struct inode *dir, struct
637 error = -EACCES; /* shouldn't it be ENOSYS? */
638 - if (!dir->i_op || !dir->i_op->create)
639 + if (!dir->i_op || (!dir->i_op->create && !dir->i_op->create_it))
644 - error = dir->i_op->create(dir, dentry, mode);
645 + if (dir->i_op->create_it)
646 + error = dir->i_op->create_it(dir, dentry, mode, it);
648 + error = dir->i_op->create(dir, dentry, mode);
652 @@ -996,6 +1118,11 @@ exit_lock:
656 +int vfs_create(struct inode *dir, struct dentry *dentry, int mode)
658 + return vfs_create_it(dir, dentry, mode, NULL);
664 @@ -1010,7 +1137,8 @@ exit_lock:
665 * for symlinks (where the permissions are checked later).
668 -int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
669 +int open_namei_it(const char *pathname, int flag, int mode,
670 + struct nameidata *nd, struct lookup_intent *it)
672 int acc_mode, error = 0;
674 @@ -1024,7 +1152,7 @@ int open_namei(const char * pathname, in
675 * The simplest case - just a plain lookup.
677 if (!(flag & O_CREAT)) {
678 - error = path_lookup(pathname, lookup_flags(flag), nd);
679 + error = path_lookup_it(pathname, lookup_flags(flag), nd, it);
683 @@ -1034,6 +1162,10 @@ int open_namei(const char * pathname, in
685 * Create - we need to know the parent.
688 + it->it_mode = mode;
689 + it->it_op |= IT_CREAT;
691 error = path_lookup(pathname, LOOKUP_PARENT, nd);
694 @@ -1049,7 +1181,7 @@ int open_namei(const char * pathname, in
697 down(&dir->d_inode->i_sem);
698 - dentry = lookup_hash(&nd->last, nd->dentry);
699 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
702 error = PTR_ERR(dentry);
703 @@ -1058,10 +1190,11 @@ do_last:
707 + it->it_mode = mode;
708 /* Negative dentry, just create the file */
709 if (!dentry->d_inode) {
710 - error = vfs_create(dir->d_inode, dentry,
711 - mode & ~current->fs->umask);
712 + error = vfs_create_it(dir->d_inode, dentry,
713 + mode & ~current->fs->umask, it);
714 up(&dir->d_inode->i_sem);
717 @@ -1086,7 +1219,7 @@ do_last:
719 if (flag & O_NOFOLLOW)
721 - while (__follow_down(&nd->mnt,&dentry) && d_mountpoint(dentry));
722 + while (__follow_down(&nd->mnt,&dentry,it) && d_mountpoint(dentry));
725 if (!dentry->d_inode)
726 @@ -1165,7 +1298,7 @@ ok:
730 - error = do_truncate(dentry, 0);
731 + error = do_truncate(dentry, 0, 1);
733 put_write_access(inode);
735 @@ -1177,8 +1310,10 @@ ok:
739 + intent_release(it);
742 + intent_release(it);
746 @@ -1197,7 +1332,16 @@ do_link:
747 * are done. Procfs-like symlinks just set LAST_BIND.
749 UPDATE_ATIME(dentry->d_inode);
751 error = dentry->d_inode->i_op->follow_link(dentry, nd);
753 + intent_release(it);
754 + } else if (it != NULL && !(it->it_int_flags & IT_FL_FOLLOWED)) {
755 + /* vfs_follow_link was never called */
756 + intent_release(it);
763 @@ -1219,13 +1363,20 @@ do_link:
766 down(&dir->d_inode->i_sem);
767 - dentry = lookup_hash(&nd->last, nd->dentry);
768 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
769 putname(nd->last.name);
773 +int open_namei(const char *pathname, int flag, int mode, struct nameidata *nd)
775 + return open_namei_it(pathname, flag, mode, nd, NULL);
780 -static struct dentry *lookup_create(struct nameidata *nd, int is_dir)
781 +static struct dentry *lookup_create(struct nameidata *nd, int is_dir,
782 + struct lookup_intent *it)
784 struct dentry *dentry;
786 @@ -1233,7 +1384,7 @@ static struct dentry *lookup_create(stru
787 dentry = ERR_PTR(-EEXIST);
788 if (nd->last_type != LAST_NORM)
790 - dentry = lookup_hash(&nd->last, nd->dentry);
791 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
794 if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
795 @@ -1289,7 +1440,16 @@ asmlinkage long sys_mknod(const char * f
796 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
799 - dentry = lookup_create(&nd, 0);
801 + if (nd.dentry->d_inode->i_op->mknod_raw) {
802 + struct inode_operations *op = nd.dentry->d_inode->i_op;
803 + error = op->mknod_raw(&nd, mode, dev);
804 + /* the file system wants to use normal vfs path now */
805 + if (error != -EOPNOTSUPP)
809 + dentry = lookup_create(&nd, 0, NULL);
810 error = PTR_ERR(dentry);
812 mode &= ~current->fs->umask;
813 @@ -1310,6 +1470,7 @@ asmlinkage long sys_mknod(const char * f
816 up(&nd.dentry->d_inode->i_sem);
821 @@ -1357,7 +1518,14 @@ asmlinkage long sys_mkdir(const char * p
822 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
825 - dentry = lookup_create(&nd, 1);
826 + if (nd.dentry->d_inode->i_op->mkdir_raw) {
827 + struct inode_operations *op = nd.dentry->d_inode->i_op;
828 + error = op->mkdir_raw(&nd, mode);
829 + /* the file system wants to use normal vfs path now */
830 + if (error != -EOPNOTSUPP)
833 + dentry = lookup_create(&nd, 1, NULL);
834 error = PTR_ERR(dentry);
835 if (!IS_ERR(dentry)) {
836 error = vfs_mkdir(nd.dentry->d_inode, dentry,
837 @@ -1365,6 +1533,7 @@ asmlinkage long sys_mkdir(const char * p
840 up(&nd.dentry->d_inode->i_sem);
845 @@ -1465,8 +1634,16 @@ asmlinkage long sys_rmdir(const char * p
849 + if (nd.dentry->d_inode->i_op->rmdir_raw) {
850 + struct inode_operations *op = nd.dentry->d_inode->i_op;
852 + error = op->rmdir_raw(&nd);
853 + /* the file system wants to use normal vfs path now */
854 + if (error != -EOPNOTSUPP)
857 down(&nd.dentry->d_inode->i_sem);
858 - dentry = lookup_hash(&nd.last, nd.dentry);
859 + dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
860 error = PTR_ERR(dentry);
861 if (!IS_ERR(dentry)) {
862 error = vfs_rmdir(nd.dentry->d_inode, dentry);
863 @@ -1524,8 +1701,15 @@ asmlinkage long sys_unlink(const char *
865 if (nd.last_type != LAST_NORM)
867 + if (nd.dentry->d_inode->i_op->unlink_raw) {
868 + struct inode_operations *op = nd.dentry->d_inode->i_op;
869 + error = op->unlink_raw(&nd);
870 + /* the file system wants to use normal vfs path now */
871 + if (error != -EOPNOTSUPP)
874 down(&nd.dentry->d_inode->i_sem);
875 - dentry = lookup_hash(&nd.last, nd.dentry);
876 + dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
877 error = PTR_ERR(dentry);
878 if (!IS_ERR(dentry)) {
879 /* Why not before? Because we want correct error value */
880 @@ -1592,15 +1776,23 @@ asmlinkage long sys_symlink(const char *
881 error = path_lookup(to, LOOKUP_PARENT, &nd);
884 - dentry = lookup_create(&nd, 0);
885 + if (nd.dentry->d_inode->i_op->symlink_raw) {
886 + struct inode_operations *op = nd.dentry->d_inode->i_op;
887 + error = op->symlink_raw(&nd, from);
888 + /* the file system wants to use normal vfs path now */
889 + if (error != -EOPNOTSUPP)
892 + dentry = lookup_create(&nd, 0, NULL);
893 error = PTR_ERR(dentry);
894 if (!IS_ERR(dentry)) {
895 error = vfs_symlink(nd.dentry->d_inode, dentry, from);
898 up(&nd.dentry->d_inode->i_sem);
906 @@ -1676,7 +1868,14 @@ asmlinkage long sys_link(const char * ol
908 if (old_nd.mnt != nd.mnt)
910 - new_dentry = lookup_create(&nd, 0);
911 + if (nd.dentry->d_inode->i_op->link_raw) {
912 + struct inode_operations *op = nd.dentry->d_inode->i_op;
913 + error = op->link_raw(&old_nd, &nd);
914 + /* the file system wants to use normal vfs path now */
915 + if (error != -EOPNOTSUPP)
918 + new_dentry = lookup_create(&nd, 0, NULL);
919 error = PTR_ERR(new_dentry);
920 if (!IS_ERR(new_dentry)) {
921 error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
922 @@ -1720,7 +1919,7 @@ exit:
925 int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
926 - struct inode *new_dir, struct dentry *new_dentry)
927 + struct inode *new_dir, struct dentry *new_dentry)
930 struct inode *target;
931 @@ -1799,7 +1998,7 @@ out_unlock:
934 int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
935 - struct inode *new_dir, struct dentry *new_dentry)
936 + struct inode *new_dir, struct dentry *new_dentry)
940 @@ -1887,9 +2086,18 @@ static inline int do_rename(const char *
941 if (newnd.last_type != LAST_NORM)
944 + if (old_dir->d_inode->i_op->rename_raw) {
946 + error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
948 + /* the file system wants to use normal vfs path now */
949 + if (error != -EOPNOTSUPP)
953 double_lock(new_dir, old_dir);
955 - old_dentry = lookup_hash(&oldnd.last, old_dir);
956 + old_dentry = lookup_hash_it(&oldnd.last, old_dir, NULL);
957 error = PTR_ERR(old_dentry);
958 if (IS_ERR(old_dentry))
960 @@ -1905,16 +2113,16 @@ static inline int do_rename(const char *
961 if (newnd.last.name[newnd.last.len])
964 - new_dentry = lookup_hash(&newnd.last, new_dir);
965 + new_dentry = lookup_hash_it(&newnd.last, new_dir, NULL);
966 error = PTR_ERR(new_dentry);
967 if (IS_ERR(new_dentry))
972 error = vfs_rename(old_dir->d_inode, old_dentry,
973 new_dir->d_inode, new_dentry);
979 @@ -1965,20 +2173,28 @@ out:
983 -__vfs_follow_link(struct nameidata *nd, const char *link)
984 +__vfs_follow_link(struct nameidata *nd, const char *link,
985 + struct lookup_intent *it)
994 + else if (it != nd->it)
995 + printk("it != nd->it: tell phil@clusterfs.com\n");
997 + it->it_int_flags |= IT_FL_FOLLOWED;
1001 if (!walk_init_root(link, nd))
1002 /* weird __emul_prefix() stuff did it */
1005 - res = link_path_walk(link, nd);
1006 + res = link_path_walk_it(link, nd, it);
1008 if (current->link_count || res || nd->last_type!=LAST_NORM)
1010 @@ -2002,7 +2218,13 @@ fail:
1012 int vfs_follow_link(struct nameidata *nd, const char *link)
1014 - return __vfs_follow_link(nd, link);
1015 + return __vfs_follow_link(nd, link, NULL);
1018 +int vfs_follow_link_it(struct nameidata *nd, const char *link,
1019 + struct lookup_intent *it)
1021 + return __vfs_follow_link(nd, link, it);
1024 /* get the link contents into pagecache */
1025 @@ -2044,7 +2266,7 @@ int page_follow_link(struct dentry *dent
1027 struct page *page = NULL;
1028 char *s = page_getlink(dentry, &page);
1029 - int res = __vfs_follow_link(nd, s);
1030 + int res = __vfs_follow_link(nd, s, NULL);
1033 page_cache_release(page);
1034 --- kernel-2.4.20-6chaos_18_7/fs/open.c~vfs_intent_2.4.20_chaos Tue Jun 24 09:11:51 2003
1035 +++ kernel-2.4.20-6chaos_18_7-shaver/fs/open.c Wed Jul 16 04:21:21 2003
1037 #include <asm/uaccess.h>
1039 #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
1040 +extern int path_walk_it(const char *name, struct nameidata *nd,
1041 + struct lookup_intent *it);
1043 int vfs_statfs(struct super_block *sb, struct statfs *buf)
1045 @@ -95,9 +97,10 @@ void fd_install(unsigned int fd, struct
1046 write_unlock(&files->file_lock);
1049 -int do_truncate(struct dentry *dentry, loff_t length)
1050 +int do_truncate(struct dentry *dentry, loff_t length, int called_from_open)
1052 struct inode *inode = dentry->d_inode;
1053 + struct inode_operations *op = dentry->d_inode->i_op;
1055 struct iattr newattrs;
1057 @@ -108,7 +111,13 @@ int do_truncate(struct dentry *dentry, l
1058 down(&inode->i_sem);
1059 newattrs.ia_size = length;
1060 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
1061 - error = notify_change(dentry, &newattrs);
1062 + if (called_from_open)
1063 + newattrs.ia_valid |= ATTR_FROM_OPEN;
1064 + if (op->setattr_raw) {
1065 + newattrs.ia_valid |= ATTR_RAW;
1066 + error = op->setattr_raw(inode, &newattrs);
1068 + error = notify_change(dentry, &newattrs);
1072 @@ -118,12 +127,13 @@ static inline long do_sys_truncate(const
1073 struct nameidata nd;
1074 struct inode * inode;
1076 + struct lookup_intent it = { .it_op = IT_GETATTR };
1079 if (length < 0) /* sorry, but loff_t says... */
1082 - error = user_path_walk(path, &nd);
1083 + error = user_path_walk_it(path, &nd, &it);
1086 inode = nd.dentry->d_inode;
1087 @@ -163,11 +173,13 @@ static inline long do_sys_truncate(const
1088 error = locks_verify_truncate(inode, NULL, length);
1091 - error = do_truncate(nd.dentry, length);
1092 + intent_release(&it);
1093 + error = do_truncate(nd.dentry, length, 0);
1095 put_write_access(inode);
1098 + intent_release(&it);
1102 @@ -215,7 +227,7 @@ static inline long do_sys_ftruncate(unsi
1104 error = locks_verify_truncate(inode, file, length);
1106 - error = do_truncate(dentry, length);
1107 + error = do_truncate(dentry, length, 0);
1111 @@ -260,11 +272,13 @@ asmlinkage long sys_utime(char * filenam
1112 struct inode * inode;
1113 struct iattr newattrs;
1115 - error = user_path_walk(filename, &nd);
1116 + error = user_path_walk_it(filename, &nd, NULL);
1119 inode = nd.dentry->d_inode;
1121 + /* this is safe without a Lustre lock because it only depends
1122 + on the super block */
1124 if (IS_RDONLY(inode))
1126 @@ -279,11 +293,25 @@ asmlinkage long sys_utime(char * filenam
1129 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
1133 + if (inode->i_op->setattr_raw) {
1134 + struct inode_operations *op = nd.dentry->d_inode->i_op;
1136 + newattrs.ia_valid |= ATTR_RAW;
1137 + error = op->setattr_raw(inode, &newattrs);
1138 + /* the file system wants to use normal vfs path now */
1139 + if (error != -EOPNOTSUPP)
1140 + goto dput_and_out;
1145 if (current->fsuid != inode->i_uid &&
1146 (error = permission(inode,MAY_WRITE)) != 0)
1150 error = notify_change(nd.dentry, &newattrs);
1153 @@ -304,12 +332,14 @@ asmlinkage long sys_utimes(char * filena
1154 struct inode * inode;
1155 struct iattr newattrs;
1157 - error = user_path_walk(filename, &nd);
1158 + error = user_path_walk_it(filename, &nd, NULL);
1162 inode = nd.dentry->d_inode;
1164 + /* this is safe without a Lustre lock because it only depends
1165 + on the super block */
1167 if (IS_RDONLY(inode))
1169 @@ -324,7 +354,20 @@ asmlinkage long sys_utimes(char * filena
1170 newattrs.ia_atime = times[0].tv_sec;
1171 newattrs.ia_mtime = times[1].tv_sec;
1172 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
1176 + if (inode->i_op->setattr_raw) {
1177 + struct inode_operations *op = nd.dentry->d_inode->i_op;
1179 + newattrs.ia_valid |= ATTR_RAW;
1180 + error = op->setattr_raw(inode, &newattrs);
1181 + /* the file system wants to use normal vfs path now */
1182 + if (error != -EOPNOTSUPP)
1183 + goto dput_and_out;
1188 if (current->fsuid != inode->i_uid &&
1189 (error = permission(inode,MAY_WRITE)) != 0)
1191 @@ -347,6 +390,7 @@ asmlinkage long sys_access(const char *
1192 int old_fsuid, old_fsgid;
1193 kernel_cap_t old_cap;
1195 + struct lookup_intent it = { .it_op = IT_GETATTR };
1197 if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
1199 @@ -364,13 +408,14 @@ asmlinkage long sys_access(const char *
1201 current->cap_effective = current->cap_permitted;
1203 - res = user_path_walk(filename, &nd);
1204 + res = user_path_walk_it(filename, &nd, &it);
1206 res = permission(nd.dentry->d_inode, mode);
1207 /* SuS v2 requires we report a read only fs too */
1208 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
1209 && !special_file(nd.dentry->d_inode->i_mode))
1211 + intent_release(&it);
1215 @@ -385,8 +430,9 @@ asmlinkage long sys_chdir(const char * f
1218 struct nameidata nd;
1219 + struct lookup_intent it = { .it_op = IT_GETATTR };
1221 - error = __user_walk(filename,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd);
1222 + error = __user_walk_it(filename,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd, &it);
1226 @@ -397,6 +443,7 @@ asmlinkage long sys_chdir(const char * f
1227 set_fs_pwd(current->fs, nd.mnt, nd.dentry);
1230 + intent_release(&it);
1234 @@ -436,9 +483,10 @@ asmlinkage long sys_chroot(const char *
1237 struct nameidata nd;
1238 + struct lookup_intent it = { .it_op = IT_GETATTR };
1240 - error = __user_walk(filename, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
1241 - LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
1242 + error = __user_walk_it(filename, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
1243 + LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd, &it);
1247 @@ -454,6 +502,7 @@ asmlinkage long sys_chroot(const char *
1251 + intent_release(&it);
1255 @@ -508,6 +557,18 @@ asmlinkage long sys_chmod(const char * f
1256 if (IS_RDONLY(inode))
1259 + if (inode->i_op->setattr_raw) {
1260 + struct inode_operations *op = nd.dentry->d_inode->i_op;
1262 + newattrs.ia_mode = mode;
1263 + newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1264 + newattrs.ia_valid |= ATTR_RAW;
1265 + error = op->setattr_raw(inode, &newattrs);
1266 + /* the file system wants to use normal vfs path now */
1267 + if (error != -EOPNOTSUPP)
1268 + goto dput_and_out;
1272 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1274 @@ -538,6 +599,20 @@ static int chown_common(struct dentry *
1276 if (IS_RDONLY(inode))
1279 + if (inode->i_op->setattr_raw) {
1280 + struct inode_operations *op = dentry->d_inode->i_op;
1282 + newattrs.ia_uid = user;
1283 + newattrs.ia_gid = group;
1284 + newattrs.ia_valid = ATTR_UID | ATTR_GID | ATTR_CTIME;
1285 + newattrs.ia_valid |= ATTR_RAW;
1286 + error = op->setattr_raw(inode, &newattrs);
1287 + /* the file system wants to use normal vfs path now */
1288 + if (error != -EOPNOTSUPP)
1293 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1295 @@ -642,8 +717,9 @@ struct file *filp_open(const char * file
1297 int namei_flags, error;
1298 struct nameidata nd;
1300 - flags &= ~O_DIRECT;
1301 + struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = flags };
1303 + //flags &= ~O_DIRECT;
1305 namei_flags = flags;
1306 if ((namei_flags+1) & O_ACCMODE)
1307 @@ -651,14 +727,15 @@ struct file *filp_open(const char * file
1308 if (namei_flags & O_TRUNC)
1311 - error = open_namei(filename, namei_flags, mode, &nd);
1313 - return dentry_open(nd.dentry, nd.mnt, flags);
1314 + error = open_namei_it(filename, namei_flags, mode, &nd, &it);
1316 + return ERR_PTR(error);
1318 - return ERR_PTR(error);
1319 + return dentry_open_it(nd.dentry, nd.mnt, flags, &it);
1322 -struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1323 +struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1324 + int flags, struct lookup_intent *it)
1327 struct inode *inode;
1328 @@ -695,12 +772,15 @@ struct file *dentry_open(struct dentry *
1331 if (f->f_op && f->f_op->open) {
1333 error = f->f_op->open(inode,f);
1338 f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
1340 + intent_release(it);
1344 @@ -715,11 +795,17 @@ cleanup_all:
1348 + intent_release(it);
1351 return ERR_PTR(error);
1354 +struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1356 + return dentry_open_it(dentry, mnt, flags, NULL);
1360 * Find an empty file descriptor entry, and mark it busy.
1362 --- kernel-2.4.20-6chaos_18_7/fs/stat.c~vfs_intent_2.4.20_chaos Thu May 15 20:14:25 2003
1363 +++ kernel-2.4.20-6chaos_18_7-shaver/fs/stat.c Wed Jul 16 04:21:21 2003
1365 * Revalidate the inode. This is required for proper NFS attribute caching.
1367 static __inline__ int
1368 -do_revalidate(struct dentry *dentry)
1369 +do_revalidate(struct dentry *dentry, struct lookup_intent *it)
1371 struct inode * inode = dentry->d_inode;
1372 - if (inode->i_op && inode->i_op->revalidate)
1373 + if (inode->i_op && inode->i_op->revalidate_it)
1374 + return inode->i_op->revalidate_it(dentry, it);
1375 + else if (inode->i_op && inode->i_op->revalidate)
1376 return inode->i_op->revalidate(dentry);
1380 -static int do_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
1381 +static int do_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat, struct lookup_intent *it)
1384 unsigned int blocks, indirect;
1385 struct inode *inode = dentry->d_inode;
1387 - res = do_revalidate(dentry);
1388 + res = do_revalidate(dentry, it);
1392 @@ -104,10 +106,12 @@ int vfs_stat(char *name, struct kstat *s
1394 struct nameidata nd;
1396 + struct lookup_intent it = { .it_op = IT_GETATTR };
1398 - error = user_path_walk(name, &nd);
1399 + error = user_path_walk_it(name, &nd, &it);
1401 - error = do_getattr(nd.mnt, nd.dentry, stat);
1402 + error = do_getattr(nd.mnt, nd.dentry, stat, &it);
1403 + intent_release(&it);
1407 @@ -117,10 +121,12 @@ int vfs_lstat(char *name, struct kstat *
1409 struct nameidata nd;
1411 + struct lookup_intent it = { .it_op = IT_GETATTR };
1413 - error = user_path_walk_link(name, &nd);
1414 + error = user_path_walk_link_it(name, &nd, &it);
1416 - error = do_getattr(nd.mnt, nd.dentry, stat);
1417 + error = do_getattr(nd.mnt, nd.dentry, stat, &it);
1418 + intent_release(&it);
1422 @@ -132,7 +138,7 @@ int vfs_fstat(unsigned int fd, struct ks
1426 - error = do_getattr(f->f_vfsmnt, f->f_dentry, stat);
1427 + error = do_getattr(f->f_vfsmnt, f->f_dentry, stat, NULL);
1431 @@ -279,7 +285,7 @@ asmlinkage long sys_readlink(const char
1434 if (inode->i_op && inode->i_op->readlink &&
1435 - !(error = do_revalidate(nd.dentry))) {
1436 + !(error = do_revalidate(nd.dentry, NULL))) {
1437 UPDATE_ATIME(inode);
1438 error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
1440 --- kernel-2.4.20-6chaos_18_7/fs/proc/base.c~vfs_intent_2.4.20_chaos Mon Jun 23 05:49:00 2003
1441 +++ kernel-2.4.20-6chaos_18_7-shaver/fs/proc/base.c Wed Jul 16 04:21:21 2003
1442 @@ -465,6 +465,9 @@ static int proc_pid_follow_link(struct d
1444 error = inode->u.proc_i.op.proc_get_link(inode, &nd->dentry, &nd->mnt);
1445 nd->last_type = LAST_BIND;
1447 + if (nd->it != NULL)
1448 + nd->it->it_int_flags |= IT_FL_FOLLOWED;
1452 --- kernel-2.4.20-6chaos_18_7/include/linux/dcache.h~vfs_intent_2.4.20_chaos Tue Jun 24 10:31:16 2003
1453 +++ kernel-2.4.20-6chaos_18_7-shaver/include/linux/dcache.h Wed Jul 16 04:22:30 2003
1455 #include <asm/atomic.h>
1456 #include <linux/mount.h>
1457 #include <linux/kernel.h>
1458 +#include <linux/string.h>
1460 +#define IT_OPEN 0x0001
1461 +#define IT_CREAT 0x0002
1462 +#define IT_READDIR 0x0004
1463 +#define IT_GETATTR 0x0008
1464 +#define IT_LOOKUP 0x0010
1465 +#define IT_UNLINK 0x0020
1466 +#define IT_GETXATTR 0x0040
1467 +#define IT_EXEC 0x0080
1468 +#define IT_PIN 0x0100
1470 +#define IT_FL_LOCKED 0x0001
1471 +#define IT_FL_FOLLOWED 0x0002 /* set by vfs_follow_link */
1473 +#define INTENT_MAGIC 0x19620323
1475 +struct lookup_intent {
1477 + void (*it_op_release)(struct lookup_intent *);
1481 + int it_disposition;
1484 + __u64 it_lock_handle[2];
1489 +static inline void intent_init(struct lookup_intent *it, int op, int flags)
1491 + memset(it, 0, sizeof(*it));
1492 + it->it_magic = INTENT_MAGIC;
1494 + it->it_flags = flags;
1499 * linux/include/linux/dcache.h
1500 @@ -96,8 +135,22 @@ struct dentry_operations {
1501 int (*d_delete)(struct dentry *);
1502 void (*d_release)(struct dentry *);
1503 void (*d_iput)(struct dentry *, struct inode *);
1504 + int (*d_revalidate_it)(struct dentry *, int, struct lookup_intent *);
1505 + void (*d_pin)(struct dentry *, struct vfsmount * , int);
1506 + void (*d_unpin)(struct dentry *, struct vfsmount *, int);
1509 +#define PIN(de,mnt,flag) if (de->d_op && de->d_op->d_pin) \
1510 + de->d_op->d_pin(de, mnt, flag);
1511 +#define UNPIN(de,mnt,flag) if (de->d_op && de->d_op->d_unpin) \
1512 + de->d_op->d_unpin(de, mnt, flag);
1515 +/* defined in fs/namei.c */
1516 +extern void intent_release(struct lookup_intent *it);
1517 +/* defined in fs/dcache.c */
1518 +extern void __d_rehash(struct dentry * entry, int lock);
1520 /* the dentry parameter passed to d_hash and d_compare is the parent
1521 * directory of the entries to be compared. It is used in case these
1522 * functions need any directory specific information for determining
1523 @@ -129,6 +182,7 @@ d_iput: no no yes
1524 * s_nfsd_free_path semaphore will be down
1526 #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
1527 +#define DCACHE_LUSTRE_INVALID 0x0010 /* Lustre invalidated */
1529 extern spinlock_t dcache_lock;
1531 --- kernel-2.4.20-6chaos_18_7/include/linux/fs.h~vfs_intent_2.4.20_chaos Wed Jul 16 04:21:20 2003
1532 +++ kernel-2.4.20-6chaos_18_7-shaver/include/linux/fs.h Wed Jul 16 04:21:21 2003
1533 @@ -337,6 +337,9 @@ extern void set_bh_page(struct buffer_he
1534 #define ATTR_MTIME_SET 256
1535 #define ATTR_FORCE 512 /* Not a change, but a change it */
1536 #define ATTR_ATTR_FLAG 1024
1537 +#define ATTR_RAW 0x0800 /* file system, not vfs will massage attrs */
1538 +#define ATTR_FROM_OPEN 0x1000 /* called from open path, ie O_TRUNC */
1539 +#define ATTR_CTIME_SET 0x2000
1542 * This is the Inode Attributes structure, used for notify_change(). It
1543 @@ -574,6 +577,7 @@ struct file {
1545 /* needed for tty driver, and maybe others */
1547 + struct lookup_intent *f_it;
1549 /* preallocated helper kiobuf to speedup O_DIRECT */
1550 struct kiobuf *f_iobuf;
1551 @@ -701,6 +705,7 @@ struct nameidata {
1555 + struct lookup_intent *it;
1559 @@ -821,7 +826,8 @@ extern int vfs_symlink(struct inode *, s
1560 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1561 extern int vfs_rmdir(struct inode *, struct dentry *);
1562 extern int vfs_unlink(struct inode *, struct dentry *);
1563 -extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
1564 +int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1565 + struct inode *new_dir, struct dentry *new_dentry);
1569 @@ -881,21 +887,32 @@ struct file_operations {
1571 struct inode_operations {
1572 int (*create) (struct inode *,struct dentry *,int);
1573 + int (*create_it) (struct inode *,struct dentry *,int, struct lookup_intent *);
1574 struct dentry * (*lookup) (struct inode *,struct dentry *);
1575 + struct dentry * (*lookup_it) (struct inode *,struct dentry *, struct lookup_intent *, int flags);
1576 int (*link) (struct dentry *,struct inode *,struct dentry *);
1577 + int (*link_raw) (struct nameidata *,struct nameidata *);
1578 int (*unlink) (struct inode *,struct dentry *);
1579 + int (*unlink_raw) (struct nameidata *);
1580 int (*symlink) (struct inode *,struct dentry *,const char *);
1581 + int (*symlink_raw) (struct nameidata *,const char *);
1582 int (*mkdir) (struct inode *,struct dentry *,int);
1583 + int (*mkdir_raw) (struct nameidata *,int);
1584 int (*rmdir) (struct inode *,struct dentry *);
1585 + int (*rmdir_raw) (struct nameidata *);
1586 int (*mknod) (struct inode *,struct dentry *,int,int);
1587 + int (*mknod_raw) (struct nameidata *,int,dev_t);
1588 int (*rename) (struct inode *, struct dentry *,
1589 struct inode *, struct dentry *);
1590 + int (*rename_raw) (struct nameidata *, struct nameidata *);
1591 int (*readlink) (struct dentry *, char *,int);
1592 int (*follow_link) (struct dentry *, struct nameidata *);
1593 void (*truncate) (struct inode *);
1594 int (*permission) (struct inode *, int);
1595 int (*revalidate) (struct dentry *);
1596 + int (*revalidate_it) (struct dentry *, struct lookup_intent *);
1597 int (*setattr) (struct dentry *, struct iattr *);
1598 + int (*setattr_raw) (struct inode *, struct iattr *);
1599 int (*getattr) (struct dentry *, struct iattr *);
1600 int (*setxattr) (struct dentry *, const char *, void *, size_t, int);
1601 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
1602 @@ -1093,10 +1110,14 @@ static inline int get_lease(struct inode
1604 asmlinkage long sys_open(const char *, int, int);
1605 asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
1606 -extern int do_truncate(struct dentry *, loff_t start);
1607 +extern int do_truncate(struct dentry *, loff_t start, int called_from_open);
1609 extern struct file *filp_open(const char *, int, int);
1610 extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
1611 +extern int open_namei_it(const char *filename, int namei_flags, int mode,
1612 + struct nameidata *nd, struct lookup_intent *it);
1613 +extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1614 + int flags, struct lookup_intent *it);
1615 extern int filp_close(struct file *, fl_owner_t id);
1616 extern char * getname(const char *);
1618 @@ -1387,6 +1408,7 @@ typedef int (*read_actor_t)(read_descrip
1619 extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
1621 extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
1622 +extern int FASTCALL(__user_walk_it(const char *, unsigned, struct nameidata *, struct lookup_intent *it));
1623 extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
1624 extern int FASTCALL(path_walk(const char *, struct nameidata *));
1625 extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
1626 @@ -1398,6 +1420,8 @@ extern struct dentry * lookup_one_len(co
1627 extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
1628 #define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
1629 #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
1630 +#define user_path_walk_it(name,nd,it) __user_walk_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd, it)
1631 +#define user_path_walk_link_it(name,nd,it) __user_walk_it(name, LOOKUP_POSITIVE, nd, it)
1633 extern void inode_init_once(struct inode *);
1634 extern void iput(struct inode *);
1635 @@ -1497,6 +1521,8 @@ extern struct file_operations generic_ro
1637 extern int vfs_readlink(struct dentry *, char *, int, const char *);
1638 extern int vfs_follow_link(struct nameidata *, const char *);
1639 +extern int vfs_follow_link_it(struct nameidata *, const char *,
1640 + struct lookup_intent *it);
1641 extern int page_readlink(struct dentry *, char *, int);
1642 extern int page_follow_link(struct dentry *, struct nameidata *);
1643 extern struct inode_operations page_symlink_inode_operations;
1644 --- kernel-2.4.20-6chaos_18_7/include/linux/fs_struct.h~vfs_intent_2.4.20_chaos Tue Jun 24 10:31:16 2003
1645 +++ kernel-2.4.20-6chaos_18_7-shaver/include/linux/fs_struct.h Wed Jul 16 04:21:21 2003
1646 @@ -37,10 +37,12 @@ static inline void set_fs_root(struct fs
1647 write_lock(&fs->lock);
1648 old_root = fs->root;
1649 old_rootmnt = fs->rootmnt;
1650 + PIN(dentry, mnt, 1);
1651 fs->rootmnt = mntget(mnt);
1652 fs->root = dget(dentry);
1653 write_unlock(&fs->lock);
1655 + UNPIN(old_root, old_rootmnt, 1);
1657 mntput(old_rootmnt);
1659 @@ -60,10 +62,12 @@ static inline void set_fs_pwd(struct fs_
1660 write_lock(&fs->lock);
1662 old_pwdmnt = fs->pwdmnt;
1663 + PIN(dentry, mnt, 0);
1664 fs->pwdmnt = mntget(mnt);
1665 fs->pwd = dget(dentry);
1666 write_unlock(&fs->lock);
1668 + UNPIN(old_pwd, old_pwdmnt, 0);
1672 --- kernel-2.4.20-6chaos_18_7/kernel/ksyms.c~vfs_intent_2.4.20_chaos Wed Jul 16 04:21:20 2003
1673 +++ kernel-2.4.20-6chaos_18_7-shaver/kernel/ksyms.c Wed Jul 16 04:21:21 2003
1674 @@ -299,6 +299,7 @@ EXPORT_SYMBOL(read_cache_page);
1675 EXPORT_SYMBOL(set_page_dirty);
1676 EXPORT_SYMBOL(vfs_readlink);
1677 EXPORT_SYMBOL(vfs_follow_link);
1678 +EXPORT_SYMBOL(vfs_follow_link_it);
1679 EXPORT_SYMBOL(page_readlink);
1680 EXPORT_SYMBOL(page_follow_link);
1681 EXPORT_SYMBOL(page_symlink_inode_operations);
1682 --- kernel-2.4.20-6chaos_18_7/kernel/fork.c~vfs_intent_2.4.20_chaos Thu Jun 19 10:06:09 2003
1683 +++ kernel-2.4.20-6chaos_18_7-shaver/kernel/fork.c Wed Jul 16 04:21:21 2003
1684 @@ -385,10 +385,13 @@ static inline struct fs_struct *__copy_f
1685 fs->umask = old->umask;
1686 read_lock(&old->lock);
1687 fs->rootmnt = mntget(old->rootmnt);
1688 + PIN(old->pwd, old->pwdmnt, 0);
1689 + PIN(old->root, old->rootmnt, 1);
1690 fs->root = dget(old->root);
1691 fs->pwdmnt = mntget(old->pwdmnt);
1692 fs->pwd = dget(old->pwd);
1694 + PIN(old->altroot, old->altrootmnt, 1);
1695 fs->altrootmnt = mntget(old->altrootmnt);
1696 fs->altroot = dget(old->altroot);
1698 --- kernel-2.4.20-6chaos_18_7/kernel/exit.c~vfs_intent_2.4.20_chaos Thu Jun 19 10:06:09 2003
1699 +++ kernel-2.4.20-6chaos_18_7-shaver/kernel/exit.c Wed Jul 16 04:21:21 2003
1700 @@ -241,11 +241,14 @@ static inline void __put_fs_struct(struc
1702 /* No need to hold fs->lock if we are killing it */
1703 if (atomic_dec_and_test(&fs->count)) {
1704 + UNPIN(fs->pwd, fs->pwdmnt, 0);
1705 + UNPIN(fs->root, fs->rootmnt, 1);
1707 mntput(fs->rootmnt);
1711 + UNPIN(fs->altroot, fs->altrootmnt, 1);
1713 mntput(fs->altrootmnt);