3 --- linux-2.4.20/fs/dcache.c~vfs_intent-2.4.20-rh 2003-07-17 08:32:59.000000000 -0700
4 +++ linux-2.4.20-mmonroe/fs/dcache.c 2003-07-17 08:35:22.000000000 -0700
5 @@ -186,6 +186,13 @@ int d_invalidate(struct dentry * dentry)
6 spin_unlock(&dcache_lock);
10 + /* network invalidation by Lustre */
11 + if (dentry->d_flags & DCACHE_LUSTRE_INVALID) {
12 + spin_unlock(&dcache_lock);
17 * Check whether to do a partial shrink_dcache
18 * to get rid of unused child entries.
19 @@ -839,13 +846,19 @@ void d_delete(struct dentry * dentry)
20 * Adds a dentry to the hash according to its name.
23 -void d_rehash(struct dentry * entry)
24 +void __d_rehash(struct dentry * entry, int lock)
26 struct list_head *list = d_hash(entry->d_parent, entry->d_name.hash);
27 if (!list_empty(&entry->d_hash)) BUG();
28 - spin_lock(&dcache_lock);
29 + if (lock) spin_lock(&dcache_lock);
30 list_add(&entry->d_hash, list);
31 - spin_unlock(&dcache_lock);
32 + if (lock) spin_unlock(&dcache_lock);
34 +EXPORT_SYMBOL(__d_rehash);
36 +void d_rehash(struct dentry * entry)
38 + __d_rehash(entry, 1);
41 #define do_switch(x,y) do { \
42 --- linux-2.4.20/fs/exec.c~vfs_intent-2.4.20-rh 2003-07-17 08:33:09.000000000 -0700
43 +++ linux-2.4.20-mmonroe/fs/exec.c 2003-07-17 08:35:22.000000000 -0700
44 @@ -114,8 +114,9 @@ asmlinkage long sys_uselib(const char *
48 + struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = O_RDONLY };
50 - error = user_path_walk(library, &nd);
51 + error = user_path_walk_it(library, &nd, &it);
55 @@ -127,7 +128,8 @@ asmlinkage long sys_uselib(const char *
59 - file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
60 + file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it);
61 + intent_release(&it);
62 error = PTR_ERR(file);
65 @@ -382,8 +384,9 @@ struct file *open_exec(const char *name)
69 + struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = O_RDONLY };
71 - err = path_lookup(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd);
72 + err = path_lookup_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd, &it);
75 inode = nd.dentry->d_inode;
76 @@ -395,7 +398,8 @@ struct file *open_exec(const char *name)
80 - file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
81 + file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it);
82 + intent_release(&it);
84 err = deny_write_access(file);
86 @@ -407,6 +411,7 @@ out:
90 + intent_release(&it);
94 @@ -1283,7 +1288,7 @@ int do_coredump(long signr, int exit_cod
96 if (!file->f_op->write)
98 - if (do_truncate(file->f_dentry, 0) != 0)
99 + if (do_truncate(file->f_dentry, 0, 0) != 0)
102 retval = binfmt->core_dump(signr, regs, file);
103 --- linux-2.4.18-p4smp/fs/namespace.c~vfs_intent-2.4.18-18-chaos65 2002-06-25 22:16:14.000000000 -0600
104 +++ linux-2.4.18-p4smp-braam/fs/namespace.c 2003-07-09 13:20:37.000000000 -0600
105 @@ -99,6 +99,7 @@ static void detach_mnt(struct vfsmount *
107 old_nd->dentry = mnt->mnt_mountpoint;
108 old_nd->mnt = mnt->mnt_parent;
109 + UNPIN(old_nd->dentry, old_nd->mnt, 1);
110 mnt->mnt_parent = mnt;
111 mnt->mnt_mountpoint = mnt->mnt_root;
112 list_del_init(&mnt->mnt_child);
113 @@ -110,6 +111,7 @@ static void attach_mnt(struct vfsmount *
115 mnt->mnt_parent = mntget(nd->mnt);
116 mnt->mnt_mountpoint = dget(nd->dentry);
117 + PIN(nd->dentry, nd->mnt, 1);
118 list_add(&mnt->mnt_hash, mount_hashtable+hash(nd->mnt, nd->dentry));
119 list_add(&mnt->mnt_child, &nd->mnt->mnt_mounts);
120 nd->dentry->d_mounted++;
121 @@ -485,14 +487,17 @@ static int do_loopback(struct nameidata
123 struct nameidata old_nd;
124 struct vfsmount *mnt = NULL;
125 + struct lookup_intent it = { .it_op = IT_GETATTR };
126 int err = mount_is_safe(nd);
129 if (!old_name || !*old_name)
131 - err = path_lookup(old_name, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &old_nd);
133 + err = path_lookup_it(old_name, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &old_nd, &it);
135 + intent_release(&it);
139 down_write(¤t->namespace->sem);
141 @@ -515,6 +520,7 @@ static int do_loopback(struct nameidata
144 up_write(¤t->namespace->sem);
145 + intent_release(&it);
146 path_release(&old_nd);
149 @@ -698,7 +704,8 @@ long do_mount(char * dev_name, char * di
150 unsigned long flags, void *data_page)
154 + struct lookup_intent it = { .it_op = IT_GETATTR };
159 @@ -722,10 +729,11 @@ long do_mount(char * dev_name, char * di
160 flags &= ~(MS_NOSUID|MS_NOEXEC|MS_NODEV);
162 /* ... and get the mountpoint */
163 - retval = path_lookup(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd);
165 + retval = path_lookup_it(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd, &it);
167 + intent_release(&it);
171 if (flags & MS_REMOUNT)
172 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
174 @@ -736,6 +744,8 @@ long do_mount(char * dev_name, char * di
176 retval = do_add_mount(&nd, type_page, flags, mnt_flags,
177 dev_name, data_page);
179 + intent_release(&it);
183 @@ -901,6 +911,8 @@ asmlinkage long sys_pivot_root(const cha
185 struct vfsmount *tmp;
186 struct nameidata new_nd, old_nd, parent_nd, root_parent, user_nd;
187 + struct lookup_intent new_it = { .it_op = IT_GETATTR };
188 + struct lookup_intent old_it = { .it_op = IT_GETATTR };
191 if (!capable(CAP_SYS_ADMIN))
192 @@ -908,14 +920,14 @@ asmlinkage long sys_pivot_root(const cha
196 - error = __user_walk(new_root, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &new_nd);
197 + error = __user_walk_it(new_root, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &new_nd, &new_it);
201 if (!check_mnt(new_nd.mnt))
204 - error = __user_walk(put_old, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &old_nd);
205 + error = __user_walk_it(put_old, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &old_nd, &old_it);
209 @@ -970,8 +982,10 @@ out2:
210 up(&old_nd.dentry->d_inode->i_zombie);
211 up_write(¤t->namespace->sem);
212 path_release(&user_nd);
213 + intent_release(&old_it);
214 path_release(&old_nd);
216 + intent_release(&new_it);
217 path_release(&new_nd);
220 --- linux-2.4.20/fs/namei.c~vfs_intent-2.4.20-rh 2003-07-17 08:32:47.000000000 -0700
221 +++ linux-2.4.20-mmonroe/fs/namei.c 2003-07-17 08:35:22.000000000 -0700
223 * XEmacs seems to be relying on it...
226 +void intent_release(struct lookup_intent *it)
228 + if (it && it->it_op_release)
229 + it->it_op_release(it);
233 /* In order to reduce some races, while at the same time doing additional
234 * checking and hopefully speeding things up, we copy filenames to the
235 * kernel data space before using them..
236 @@ -260,10 +267,19 @@ void path_release(struct nameidata *nd)
237 * Internal lookup() using the new generic dcache.
240 -static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name, int flags)
241 +static struct dentry *cached_lookup(struct dentry *parent, struct qstr *name,
242 + int flags, struct lookup_intent *it)
244 struct dentry * dentry = d_lookup(parent, name);
246 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
247 + if (!dentry->d_op->d_revalidate_it(dentry, flags, it) &&
248 + !d_invalidate(dentry)) {
254 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
255 if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) {
257 @@ -281,11 +297,14 @@ static struct dentry * cached_lookup(str
258 * make sure that nobody added the entry to the dcache in the meantime..
261 -static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, int flags)
262 +static struct dentry *real_lookup(struct dentry *parent, struct qstr *name,
263 + int flags, struct lookup_intent *it)
265 struct dentry * result;
266 struct inode *dir = parent->d_inode;
272 * First re-do the cached lookup just in case it was created
273 @@ -300,6 +319,9 @@ static struct dentry * real_lookup(struc
274 result = ERR_PTR(-ENOMEM);
277 + if (dir->i_op->lookup_it)
278 + result = dir->i_op->lookup_it(dir, dentry, it, flags);
280 result = dir->i_op->lookup(dir, dentry);
283 @@ -321,6 +343,12 @@ static struct dentry * real_lookup(struc
285 result = ERR_PTR(-ENOENT);
287 + } else if (result->d_op && result->d_op->d_revalidate_it) {
288 + if (!result->d_op->d_revalidate_it(result, flags, it) &&
289 + !d_invalidate(result)) {
296 @@ -334,7 +362,8 @@ int max_recursive_link = 5;
297 * Without that kind of total limit, nasty chains of consecutive
298 * symlinks can cause almost arbitrarily long lookups.
300 -static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
301 +static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd,
302 + struct lookup_intent *it)
305 if (current->link_count >= max_recursive_link)
306 @@ -348,10 +377,18 @@ static inline int do_follow_link(struct
307 current->link_count++;
308 current->total_link_count++;
309 UPDATE_ATIME(dentry->d_inode);
311 err = dentry->d_inode->i_op->follow_link(dentry, nd);
312 + if (!err && it != NULL && !(it->it_int_flags & IT_FL_FOLLOWED)) {
313 + /* vfs_follow_link was never called */
314 + intent_release(it);
318 current->link_count--;
321 + intent_release(it);
325 @@ -381,15 +418,26 @@ int follow_up(struct vfsmount **mnt, str
326 return __follow_up(mnt, dentry);
329 -static inline int __follow_down(struct vfsmount **mnt, struct dentry **dentry)
330 +static inline int __follow_down(struct vfsmount **mnt, struct dentry **dentry,
331 + struct lookup_intent *it)
333 struct vfsmount *mounted;
335 spin_lock(&dcache_lock);
336 mounted = lookup_mnt(*mnt, *dentry);
338 + int opc = 0, mode = 0;
339 *mnt = mntget(mounted);
340 spin_unlock(&dcache_lock);
343 + mode = it->it_mode;
345 + intent_release(it);
348 + it->it_mode = mode;
351 mntput(mounted->mnt_parent);
352 *dentry = dget(mounted->mnt_root);
353 @@ -401,7 +449,7 @@ static inline int __follow_down(struct v
355 int follow_down(struct vfsmount **mnt, struct dentry **dentry)
357 - return __follow_down(mnt,dentry);
358 + return __follow_down(mnt,dentry,NULL);
361 static inline void follow_dotdot(struct nameidata *nd)
362 @@ -437,7 +485,7 @@ static inline void follow_dotdot(struct
366 - while (d_mountpoint(nd->dentry) && __follow_down(&nd->mnt, &nd->dentry))
367 + while (d_mountpoint(nd->dentry) && __follow_down(&nd->mnt, &nd->dentry, NULL))
371 @@ -449,7 +497,8 @@ static inline void follow_dotdot(struct
373 * We expect 'base' to be positive and a directory.
375 -int link_path_walk(const char * name, struct nameidata *nd)
376 +int link_path_walk_it(const char *name, struct nameidata *nd,
377 + struct lookup_intent *it)
379 struct dentry *dentry;
381 @@ -526,19 +575,18 @@ int link_path_walk(const char * name, st
384 /* This does the actual lookups.. */
385 - dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
386 + dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE, NULL);
388 err = -EWOULDBLOCKIO;
391 - dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
392 + dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE, NULL);
393 err = PTR_ERR(dentry);
397 /* Check mountpoints.. */
398 - while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry))
400 + while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry, NULL));
403 inode = dentry->d_inode;
404 @@ -549,7 +597,7 @@ int link_path_walk(const char * name, st
407 if (inode->i_op->follow_link) {
408 - err = do_follow_link(dentry, nd);
409 + err = do_follow_link(dentry, nd, NULL);
413 @@ -565,7 +613,7 @@ int link_path_walk(const char * name, st
417 - if (!inode->i_op->lookup)
418 + if (!inode->i_op->lookup && !inode->i_op->lookup_it)
421 /* here ends the main loop */
422 @@ -592,22 +640,22 @@ last_component:
426 - dentry = cached_lookup(nd->dentry, &this, 0);
427 + dentry = cached_lookup(nd->dentry, &this, 0, it);
429 err = -EWOULDBLOCKIO;
432 - dentry = real_lookup(nd->dentry, &this, 0);
433 + dentry = real_lookup(nd->dentry, &this, 0, it);
434 err = PTR_ERR(dentry);
438 - while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry))
439 + while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry, it))
441 inode = dentry->d_inode;
442 if ((lookup_flags & LOOKUP_FOLLOW)
443 && inode && inode->i_op && inode->i_op->follow_link) {
444 - err = do_follow_link(dentry, nd);
445 + err = do_follow_link(dentry, nd, it);
449 @@ -621,7 +669,8 @@ last_component:
451 if (lookup_flags & LOOKUP_DIRECTORY) {
453 - if (!inode->i_op || !inode->i_op->lookup)
454 + if (!inode->i_op ||
455 + (!inode->i_op->lookup && !inode->i_op->lookup_it))
459 @@ -645,6 +694,23 @@ return_reval:
460 * Check the cached dentry for staleness.
464 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
466 + if (!dentry->d_op->d_revalidate_it(dentry, 0, it)) {
467 + struct dentry *new;
468 + err = permission(dentry->d_parent->d_inode,
472 + new = real_lookup(dentry->d_parent,
473 + &dentry->d_name, 0, NULL);
474 + d_invalidate(dentry);
477 + goto revalidate_again;
480 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
482 if (!dentry->d_op->d_revalidate(dentry, 0)) {
483 @@ -658,15 +724,28 @@ out_dput:
488 + intent_release(it);
494 +int link_path_walk(const char * name, struct nameidata *nd)
496 + return link_path_walk_it(name, nd, NULL);
499 +int path_walk_it(const char * name, struct nameidata *nd, struct lookup_intent *it)
501 + current->total_link_count = 0;
502 + return link_path_walk_it(name, nd, it);
505 int path_walk(const char * name, struct nameidata *nd)
507 current->total_link_count = 0;
508 - return link_path_walk(name, nd);
509 + return link_path_walk_it(name, nd, NULL);
513 @@ -751,6 +830,17 @@ walk_init_root(const char *name, struct
517 +int path_lookup_it(const char *path, unsigned flags, struct nameidata *nd,
518 + struct lookup_intent *it)
521 + if (path_init(path, flags, nd))
522 + error = path_walk_it(path, nd, it);
528 int path_lookup(const char *path, unsigned flags, struct nameidata *nd)
531 @@ -765,6 +855,7 @@ int path_init(const char *name, unsigned
533 nd->last_type = LAST_ROOT; /* if there are only slashes... */
537 return walk_init_root(name,nd);
538 read_lock(¤t->fs->lock);
539 @@ -779,7 +870,8 @@ int path_init(const char *name, unsigned
540 * needs parent already locked. Doesn't follow mounts.
543 -struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
544 +struct dentry * lookup_hash_it(struct qstr *name, struct dentry * base,
545 + struct lookup_intent *it)
547 struct dentry * dentry;
549 @@ -802,13 +894,16 @@ struct dentry * lookup_hash(struct qstr
553 - dentry = cached_lookup(base, name, 0);
554 + dentry = cached_lookup(base, name, 0, it);
556 struct dentry *new = d_alloc(base, name);
557 dentry = ERR_PTR(-ENOMEM);
561 + if (inode->i_op->lookup_it)
562 + dentry = inode->i_op->lookup_it(inode, new, it, 0);
564 dentry = inode->i_op->lookup(inode, new);
567 @@ -820,6 +915,12 @@ out:
571 +struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
573 + return lookup_hash_it(name, base, NULL);
578 struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
580 @@ -841,7 +942,7 @@ struct dentry * lookup_one_len(const cha
582 this.hash = end_name_hash(hash);
584 - return lookup_hash(&this, base);
585 + return lookup_hash_it(&this, base, NULL);
587 return ERR_PTR(-EACCES);
589 @@ -872,6 +973,23 @@ int __user_walk(const char *name, unsign
593 +int __user_walk_it(const char *name, unsigned flags, struct nameidata *nd,
594 + struct lookup_intent *it)
599 + tmp = getname(name);
600 + err = PTR_ERR(tmp);
601 + if (!IS_ERR(tmp)) {
603 + if (path_init(tmp, flags, nd))
604 + err = path_walk_it(tmp, nd, it);
611 * It's inline, so penalty for filesystems that don't use sticky bit is
613 @@ -969,6 +1087,37 @@ static inline int lookup_flags(unsigned
617 +static int vfs_create_it(struct inode *dir, struct dentry *dentry, int mode,
618 + struct lookup_intent *it)
625 + down(&dir->i_zombie);
626 + error = may_create(dir, dentry);
630 + error = -EACCES; /* shouldn't it be ENOSYS? */
631 + if (!dir->i_op || (!dir->i_op->create && !dir->i_op->create_it))
636 + if (dir->i_op->create_it)
637 + error = dir->i_op->create_it(dir, dentry, mode, it);
639 + error = dir->i_op->create(dir, dentry, mode);
642 + up(&dir->i_zombie);
644 + inode_dir_notify(dir, DN_CREATE);
648 int vfs_create(struct inode *dir, struct dentry *dentry, int mode)
651 @@ -1010,7 +1137,8 @@ exit_lock:
652 * for symlinks (where the permissions are checked later).
655 -int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
656 +int open_namei_it(const char *pathname, int flag, int mode,
657 + struct nameidata *nd, struct lookup_intent *it)
659 int acc_mode, error = 0;
661 @@ -1024,7 +1152,7 @@ int open_namei(const char * pathname, in
662 * The simplest case - just a plain lookup.
664 if (!(flag & O_CREAT)) {
665 - error = path_lookup(pathname, lookup_flags(flag), nd);
666 + error = path_lookup_it(pathname, lookup_flags(flag), nd, it);
670 @@ -1034,6 +1162,10 @@ int open_namei(const char * pathname, in
672 * Create - we need to know the parent.
675 + it->it_mode = mode;
676 + it->it_op |= IT_CREAT;
678 error = path_lookup(pathname, LOOKUP_PARENT, nd);
681 @@ -1049,7 +1181,7 @@ int open_namei(const char * pathname, in
684 down(&dir->d_inode->i_sem);
685 - dentry = lookup_hash(&nd->last, nd->dentry);
686 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
689 error = PTR_ERR(dentry);
690 @@ -1058,10 +1190,11 @@ do_last:
694 + it->it_mode = mode;
695 /* Negative dentry, just create the file */
696 if (!dentry->d_inode) {
697 - error = vfs_create(dir->d_inode, dentry,
698 - mode & ~current->fs->umask);
699 + error = vfs_create_it(dir->d_inode, dentry,
700 + mode & ~current->fs->umask, it);
701 up(&dir->d_inode->i_sem);
704 @@ -1086,7 +1219,7 @@ do_last:
706 if (flag & O_NOFOLLOW)
708 - while (__follow_down(&nd->mnt,&dentry) && d_mountpoint(dentry));
709 + while (__follow_down(&nd->mnt,&dentry,it) && d_mountpoint(dentry));
712 if (!dentry->d_inode)
713 @@ -1165,7 +1298,7 @@ ok:
717 - error = do_truncate(dentry, 0);
718 + error = do_truncate(dentry, 0, 1);
720 put_write_access(inode);
722 @@ -1177,8 +1310,10 @@ ok:
726 + intent_release(it);
729 + intent_release(it);
733 @@ -1197,7 +1332,16 @@ do_link:
734 * are done. Procfs-like symlinks just set LAST_BIND.
736 UPDATE_ATIME(dentry->d_inode);
738 error = dentry->d_inode->i_op->follow_link(dentry, nd);
740 + intent_release(it);
741 + } else if (it != NULL && !(it->it_int_flags & IT_FL_FOLLOWED)) {
742 + /* vfs_follow_link was never called */
743 + intent_release(it);
750 @@ -1219,13 +1363,20 @@ do_link:
753 down(&dir->d_inode->i_sem);
754 - dentry = lookup_hash(&nd->last, nd->dentry);
755 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
756 putname(nd->last.name);
760 +int open_namei(const char *pathname, int flag, int mode, struct nameidata *nd)
762 + return open_namei_it(pathname, flag, mode, nd, NULL);
767 -static struct dentry *lookup_create(struct nameidata *nd, int is_dir)
768 +static struct dentry *lookup_create(struct nameidata *nd, int is_dir,
769 + struct lookup_intent *it)
771 struct dentry *dentry;
773 @@ -1233,7 +1384,7 @@ static struct dentry *lookup_create(stru
774 dentry = ERR_PTR(-EEXIST);
775 if (nd->last_type != LAST_NORM)
777 - dentry = lookup_hash(&nd->last, nd->dentry);
778 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
781 if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
782 @@ -1289,7 +1440,16 @@ asmlinkage long sys_mknod(const char * f
783 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
786 - dentry = lookup_create(&nd, 0);
788 + if (nd.dentry->d_inode->i_op->mknod_raw) {
789 + struct inode_operations *op = nd.dentry->d_inode->i_op;
790 + error = op->mknod_raw(&nd, mode, dev);
791 + /* the file system wants to use normal vfs path now */
792 + if (error != -EOPNOTSUPP)
796 + dentry = lookup_create(&nd, 0, NULL);
797 error = PTR_ERR(dentry);
799 mode &= ~current->fs->umask;
800 @@ -1310,6 +1470,7 @@ asmlinkage long sys_mknod(const char * f
803 up(&nd.dentry->d_inode->i_sem);
808 @@ -1357,7 +1518,14 @@ asmlinkage long sys_mkdir(const char * p
809 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
812 - dentry = lookup_create(&nd, 1);
813 + if (nd.dentry->d_inode->i_op->mkdir_raw) {
814 + struct inode_operations *op = nd.dentry->d_inode->i_op;
815 + error = op->mkdir_raw(&nd, mode);
816 + /* the file system wants to use normal vfs path now */
817 + if (error != -EOPNOTSUPP)
820 + dentry = lookup_create(&nd, 1, NULL);
821 error = PTR_ERR(dentry);
822 if (!IS_ERR(dentry)) {
823 error = vfs_mkdir(nd.dentry->d_inode, dentry,
824 @@ -1365,6 +1533,7 @@ asmlinkage long sys_mkdir(const char * p
827 up(&nd.dentry->d_inode->i_sem);
832 @@ -1465,8 +1634,16 @@ asmlinkage long sys_rmdir(const char * p
836 + if (nd.dentry->d_inode->i_op->rmdir_raw) {
837 + struct inode_operations *op = nd.dentry->d_inode->i_op;
839 + error = op->rmdir_raw(&nd);
840 + /* the file system wants to use normal vfs path now */
841 + if (error != -EOPNOTSUPP)
844 down(&nd.dentry->d_inode->i_sem);
845 - dentry = lookup_hash(&nd.last, nd.dentry);
846 + dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
847 error = PTR_ERR(dentry);
848 if (!IS_ERR(dentry)) {
849 error = vfs_rmdir(nd.dentry->d_inode, dentry);
850 @@ -1524,8 +1701,15 @@ asmlinkage long sys_unlink(const char *
852 if (nd.last_type != LAST_NORM)
854 + if (nd.dentry->d_inode->i_op->unlink_raw) {
855 + struct inode_operations *op = nd.dentry->d_inode->i_op;
856 + error = op->unlink_raw(&nd);
857 + /* the file system wants to use normal vfs path now */
858 + if (error != -EOPNOTSUPP)
861 down(&nd.dentry->d_inode->i_sem);
862 - dentry = lookup_hash(&nd.last, nd.dentry);
863 + dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
864 error = PTR_ERR(dentry);
865 if (!IS_ERR(dentry)) {
866 /* Why not before? Because we want correct error value */
867 @@ -1592,15 +1776,23 @@ asmlinkage long sys_symlink(const char *
868 error = path_lookup(to, LOOKUP_PARENT, &nd);
871 - dentry = lookup_create(&nd, 0);
872 + if (nd.dentry->d_inode->i_op->symlink_raw) {
873 + struct inode_operations *op = nd.dentry->d_inode->i_op;
874 + error = op->symlink_raw(&nd, from);
875 + /* the file system wants to use normal vfs path now */
876 + if (error != -EOPNOTSUPP)
879 + dentry = lookup_create(&nd, 0, NULL);
880 error = PTR_ERR(dentry);
881 if (!IS_ERR(dentry)) {
882 error = vfs_symlink(nd.dentry->d_inode, dentry, from);
885 up(&nd.dentry->d_inode->i_sem);
893 @@ -1676,7 +1868,14 @@ asmlinkage long sys_link(const char * ol
895 if (old_nd.mnt != nd.mnt)
897 - new_dentry = lookup_create(&nd, 0);
898 + if (nd.dentry->d_inode->i_op->link_raw) {
899 + struct inode_operations *op = nd.dentry->d_inode->i_op;
900 + error = op->link_raw(&old_nd, &nd);
901 + /* the file system wants to use normal vfs path now */
902 + if (error != -EOPNOTSUPP)
905 + new_dentry = lookup_create(&nd, 0, NULL);
906 error = PTR_ERR(new_dentry);
907 if (!IS_ERR(new_dentry)) {
908 error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
909 @@ -1720,7 +1919,7 @@ exit:
912 int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
913 - struct inode *new_dir, struct dentry *new_dentry)
914 + struct inode *new_dir, struct dentry *new_dentry)
917 struct inode *target;
918 @@ -1799,7 +1998,7 @@ out_unlock:
921 int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
922 - struct inode *new_dir, struct dentry *new_dentry)
923 + struct inode *new_dir, struct dentry *new_dentry)
927 @@ -1887,9 +2086,18 @@ static inline int do_rename(const char *
928 if (newnd.last_type != LAST_NORM)
931 + if (old_dir->d_inode->i_op->rename_raw) {
933 + error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
935 + /* the file system wants to use normal vfs path now */
936 + if (error != -EOPNOTSUPP)
940 double_lock(new_dir, old_dir);
942 - old_dentry = lookup_hash(&oldnd.last, old_dir);
943 + old_dentry = lookup_hash_it(&oldnd.last, old_dir, NULL);
944 error = PTR_ERR(old_dentry);
945 if (IS_ERR(old_dentry))
947 @@ -1905,16 +2113,16 @@ static inline int do_rename(const char *
948 if (newnd.last.name[newnd.last.len])
951 - new_dentry = lookup_hash(&newnd.last, new_dir);
952 + new_dentry = lookup_hash_it(&newnd.last, new_dir, NULL);
953 error = PTR_ERR(new_dentry);
954 if (IS_ERR(new_dentry))
959 error = vfs_rename(old_dir->d_inode, old_dentry,
960 new_dir->d_inode, new_dentry);
966 @@ -1965,20 +2173,28 @@ out:
970 -__vfs_follow_link(struct nameidata *nd, const char *link)
971 +__vfs_follow_link(struct nameidata *nd, const char *link,
972 + struct lookup_intent *it)
981 + else if (it != nd->it)
982 + printk("it != nd->it: tell phil@clusterfs.com\n");
984 + it->it_int_flags |= IT_FL_FOLLOWED;
988 if (!walk_init_root(link, nd))
989 /* weird __emul_prefix() stuff did it */
992 - res = link_path_walk(link, nd);
993 + res = link_path_walk_it(link, nd, it);
995 if (current->link_count || res || nd->last_type!=LAST_NORM)
997 @@ -2002,7 +2218,13 @@ fail:
999 int vfs_follow_link(struct nameidata *nd, const char *link)
1001 - return __vfs_follow_link(nd, link);
1002 + return __vfs_follow_link(nd, link, NULL);
1005 +int vfs_follow_link_it(struct nameidata *nd, const char *link,
1006 + struct lookup_intent *it)
1008 + return __vfs_follow_link(nd, link, it);
1011 /* get the link contents into pagecache */
1012 @@ -2044,7 +2266,7 @@ int page_follow_link(struct dentry *dent
1014 struct page *page = NULL;
1015 char *s = page_getlink(dentry, &page);
1016 - int res = __vfs_follow_link(nd, s);
1017 + int res = __vfs_follow_link(nd, s, NULL);
1020 page_cache_release(page);
1021 --- linux-2.4.20/fs/open.c~vfs_intent-2.4.20-rh 2003-07-17 08:32:45.000000000 -0700
1022 +++ linux-2.4.20-mmonroe/fs/open.c 2003-07-17 08:35:22.000000000 -0700
1024 #include <asm/uaccess.h>
1026 #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
1027 +extern int path_walk_it(const char *name, struct nameidata *nd,
1028 + struct lookup_intent *it);
1030 int vfs_statfs(struct super_block *sb, struct statfs *buf)
1032 @@ -95,9 +97,10 @@ void fd_install(unsigned int fd, struct
1033 write_unlock(&files->file_lock);
1036 -int do_truncate(struct dentry *dentry, loff_t length)
1037 +int do_truncate(struct dentry *dentry, loff_t length, int called_from_open)
1039 struct inode *inode = dentry->d_inode;
1040 + struct inode_operations *op = dentry->d_inode->i_op;
1042 struct iattr newattrs;
1044 @@ -108,7 +111,13 @@ int do_truncate(struct dentry *dentry, l
1045 down(&inode->i_sem);
1046 newattrs.ia_size = length;
1047 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
1048 - error = notify_change(dentry, &newattrs);
1049 + if (called_from_open)
1050 + newattrs.ia_valid |= ATTR_FROM_OPEN;
1051 + if (op->setattr_raw) {
1052 + newattrs.ia_valid |= ATTR_RAW;
1053 + error = op->setattr_raw(inode, &newattrs);
1055 + error = notify_change(dentry, &newattrs);
1059 @@ -118,12 +127,13 @@ static inline long do_sys_truncate(const
1060 struct nameidata nd;
1061 struct inode * inode;
1063 + struct lookup_intent it = { .it_op = IT_GETATTR };
1066 if (length < 0) /* sorry, but loff_t says... */
1069 - error = user_path_walk(path, &nd);
1070 + error = user_path_walk_it(path, &nd, &it);
1073 inode = nd.dentry->d_inode;
1074 @@ -163,11 +173,13 @@ static inline long do_sys_truncate(const
1075 error = locks_verify_truncate(inode, NULL, length);
1078 - error = do_truncate(nd.dentry, length);
1079 + intent_release(&it);
1080 + error = do_truncate(nd.dentry, length, 0);
1082 put_write_access(inode);
1085 + intent_release(&it);
1089 @@ -215,7 +227,7 @@ static inline long do_sys_ftruncate(unsi
1091 error = locks_verify_truncate(inode, file, length);
1093 - error = do_truncate(dentry, length);
1094 + error = do_truncate(dentry, length, 0);
1098 @@ -260,11 +272,13 @@ asmlinkage long sys_utime(char * filenam
1099 struct inode * inode;
1100 struct iattr newattrs;
1102 - error = user_path_walk(filename, &nd);
1103 + error = user_path_walk_it(filename, &nd, NULL);
1106 inode = nd.dentry->d_inode;
1108 + /* this is safe without a Lustre lock because it only depends
1109 + on the super block */
1111 if (IS_RDONLY(inode))
1113 @@ -279,11 +293,25 @@ asmlinkage long sys_utime(char * filenam
1116 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
1120 + if (inode->i_op->setattr_raw) {
1121 + struct inode_operations *op = nd.dentry->d_inode->i_op;
1123 + newattrs.ia_valid |= ATTR_RAW;
1124 + error = op->setattr_raw(inode, &newattrs);
1125 + /* the file system wants to use normal vfs path now */
1126 + if (error != -EOPNOTSUPP)
1127 + goto dput_and_out;
1132 if (current->fsuid != inode->i_uid &&
1133 (error = permission(inode,MAY_WRITE)) != 0)
1137 error = notify_change(nd.dentry, &newattrs);
1140 @@ -304,12 +332,14 @@ asmlinkage long sys_utimes(char * filena
1141 struct inode * inode;
1142 struct iattr newattrs;
1144 - error = user_path_walk(filename, &nd);
1145 + error = user_path_walk_it(filename, &nd, NULL);
1149 inode = nd.dentry->d_inode;
1151 + /* this is safe without a Lustre lock because it only depends
1152 + on the super block */
1154 if (IS_RDONLY(inode))
1156 @@ -324,7 +354,20 @@ asmlinkage long sys_utimes(char * filena
1157 newattrs.ia_atime = times[0].tv_sec;
1158 newattrs.ia_mtime = times[1].tv_sec;
1159 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
1163 + if (inode->i_op->setattr_raw) {
1164 + struct inode_operations *op = nd.dentry->d_inode->i_op;
1166 + newattrs.ia_valid |= ATTR_RAW;
1167 + error = op->setattr_raw(inode, &newattrs);
1168 + /* the file system wants to use normal vfs path now */
1169 + if (error != -EOPNOTSUPP)
1170 + goto dput_and_out;
1175 if (current->fsuid != inode->i_uid &&
1176 (error = permission(inode,MAY_WRITE)) != 0)
1178 @@ -347,6 +390,7 @@ asmlinkage long sys_access(const char *
1179 int old_fsuid, old_fsgid;
1180 kernel_cap_t old_cap;
1182 + struct lookup_intent it = { .it_op = IT_GETATTR };
1184 if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
1186 @@ -364,13 +408,14 @@ asmlinkage long sys_access(const char *
1188 current->cap_effective = current->cap_permitted;
1190 - res = user_path_walk(filename, &nd);
1191 + res = user_path_walk_it(filename, &nd, &it);
1193 res = permission(nd.dentry->d_inode, mode);
1194 /* SuS v2 requires we report a read only fs too */
1195 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
1196 && !special_file(nd.dentry->d_inode->i_mode))
1198 + intent_release(&it);
1202 @@ -385,8 +430,11 @@ asmlinkage long sys_chdir(const char * f
1205 struct nameidata nd;
1206 + struct lookup_intent it = { .it_op = IT_GETATTR };
1208 - error = __user_walk(filename,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd);
1209 + error = __user_walk_it(filename,
1210 + LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,
1215 @@ -397,6 +443,7 @@ asmlinkage long sys_chdir(const char * f
1216 set_fs_pwd(current->fs, nd.mnt, nd.dentry);
1219 + intent_release(&it);
1223 @@ -436,9 +483,10 @@ asmlinkage long sys_chroot(const char *
1226 struct nameidata nd;
1227 + struct lookup_intent it = { .it_op = IT_GETATTR };
1229 - error = __user_walk(filename, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
1230 - LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
1231 + error = __user_walk_it(filename, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
1232 + LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd, &it);
1236 @@ -454,6 +502,7 @@ asmlinkage long sys_chroot(const char *
1240 + intent_release(&it);
1244 @@ -508,6 +557,18 @@ asmlinkage long sys_chmod(const char * f
1245 if (IS_RDONLY(inode))
1248 + if (inode->i_op->setattr_raw) {
1249 + struct inode_operations *op = nd.dentry->d_inode->i_op;
1251 + newattrs.ia_mode = mode;
1252 + newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1253 + newattrs.ia_valid |= ATTR_RAW;
1254 + error = op->setattr_raw(inode, &newattrs);
1255 + /* the file system wants to use normal vfs path now */
1256 + if (error != -EOPNOTSUPP)
1257 + goto dput_and_out;
1261 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1263 @@ -538,6 +599,20 @@ static int chown_common(struct dentry *
1265 if (IS_RDONLY(inode))
1268 + if (inode->i_op->setattr_raw) {
1269 + struct inode_operations *op = dentry->d_inode->i_op;
1271 + newattrs.ia_uid = user;
1272 + newattrs.ia_gid = group;
1273 + newattrs.ia_valid = ATTR_UID | ATTR_GID | ATTR_CTIME;
1274 + newattrs.ia_valid |= ATTR_RAW;
1275 + error = op->setattr_raw(inode, &newattrs);
1276 + /* the file system wants to use normal vfs path now */
1277 + if (error != -EOPNOTSUPP)
1282 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1284 @@ -642,8 +717,9 @@ struct file *filp_open(const char * file
1286 int namei_flags, error;
1287 struct nameidata nd;
1289 - flags &= ~O_DIRECT;
1290 + struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = flags };
1292 + //flags &= ~O_DIRECT;
1294 namei_flags = flags;
1295 if ((namei_flags+1) & O_ACCMODE)
1296 @@ -651,14 +727,15 @@ struct file *filp_open(const char * file
1297 if (namei_flags & O_TRUNC)
1300 - error = open_namei(filename, namei_flags, mode, &nd);
1302 - return dentry_open(nd.dentry, nd.mnt, flags);
1303 + error = open_namei_it(filename, namei_flags, mode, &nd, &it);
1305 + return ERR_PTR(error);
1307 - return ERR_PTR(error);
1308 + return dentry_open_it(nd.dentry, nd.mnt, flags, &it);
1311 -struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1312 +struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1313 + int flags, struct lookup_intent *it)
1316 struct inode *inode;
1317 @@ -695,12 +772,15 @@ struct file *dentry_open(struct dentry *
1320 if (f->f_op && f->f_op->open) {
1322 error = f->f_op->open(inode,f);
1327 f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
1329 + intent_release(it);
1333 @@ -715,11 +795,17 @@ cleanup_all:
1337 + intent_release(it);
1340 return ERR_PTR(error);
1343 +struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1345 + return dentry_open_it(dentry, mnt, flags, NULL);
1349 * Find an empty file descriptor entry, and mark it busy.
1351 --- linux-2.4.20/fs/proc/base.c~vfs_intent-2.4.20-rh 2003-07-17 08:33:05.000000000 -0700
1352 +++ linux-2.4.20-mmonroe/fs/proc/base.c 2003-07-17 08:35:22.000000000 -0700
1353 @@ -464,6 +464,9 @@ static int proc_pid_follow_link(struct d
1355 error = inode->u.proc_i.op.proc_get_link(inode, &nd->dentry, &nd->mnt);
1356 nd->last_type = LAST_BIND;
1358 + if (nd->it != NULL)
1359 + nd->it->it_int_flags |= IT_FL_FOLLOWED;
1363 --- linux-2.4.20/fs/stat.c~vfs_intent-2.4.20-rh 2003-07-17 08:33:05.000000000 -0700
1364 +++ linux-2.4.20-mmonroe/fs/stat.c 2003-07-17 08:51:33.000000000 -0700
1366 * Revalidate the inode. This is required for proper NFS attribute caching.
1368 static __inline__ int
1369 -do_revalidate(struct dentry *dentry)
1370 +do_revalidate(struct dentry *dentry, struct lookup_intent *it)
1372 struct inode * inode = dentry->d_inode;
1373 - if (inode->i_op && inode->i_op->revalidate)
1374 + if (inode->i_op && inode->i_op->revalidate_it)
1375 + return inode->i_op->revalidate_it(dentry, it);
1376 + else if (inode->i_op && inode->i_op->revalidate)
1377 return inode->i_op->revalidate(dentry);
1380 @@ -32,13 +34,13 @@ static inline nlink_t user_nlink(struct
1381 return inode->i_nlink;
1384 -static int do_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
1385 +static int do_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat, struct lookup_intent *it)
1388 unsigned int blocks, indirect;
1389 struct inode *inode = dentry->d_inode;
1391 - res = do_revalidate(dentry);
1392 + res = do_revalidate(dentry, it);
1396 @@ -111,10 +113,12 @@ int vfs_stat(char *name, struct kstat *s
1398 struct nameidata nd;
1400 + struct lookup_intent it = { .it_op = IT_GETATTR };
1402 - error = user_path_walk(name, &nd);
1403 + error = user_path_walk_it(name, &nd, &it);
1405 - error = do_getattr(nd.mnt, nd.dentry, stat);
1406 + error = do_getattr(nd.mnt, nd.dentry, stat, &it);
1407 + intent_release(&it);
1411 @@ -124,10 +128,12 @@ int vfs_lstat(char *name, struct kstat *
1413 struct nameidata nd;
1415 + struct lookup_intent it = { .it_op = IT_GETATTR };
1417 - error = user_path_walk_link(name, &nd);
1418 + error = user_path_walk_link_it(name, &nd, &it);
1420 - error = do_getattr(nd.mnt, nd.dentry, stat);
1421 + error = do_getattr(nd.mnt, nd.dentry, stat, &it);
1422 + intent_release(&it);
1426 @@ -139,7 +145,7 @@ int vfs_fstat(unsigned int fd, struct ks
1430 - error = do_getattr(f->f_vfsmnt, f->f_dentry, stat);
1431 + error = do_getattr(f->f_vfsmnt, f->f_dentry, stat, NULL);
1435 @@ -286,7 +292,7 @@ asmlinkage long sys_readlink(const char
1438 if (inode->i_op && inode->i_op->readlink &&
1439 - !(error = do_revalidate(nd.dentry))) {
1440 + !(error = do_revalidate(nd.dentry, NULL))) {
1441 UPDATE_ATIME(inode);
1442 error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
1444 --- linux-2.4.20/include/linux/dcache.h~vfs_intent-2.4.20-rh 2003-07-17 08:32:48.000000000 -0700
1445 +++ linux-2.4.20-mmonroe/include/linux/dcache.h 2003-07-17 08:35:22.000000000 -0700
1447 #include <asm/atomic.h>
1448 #include <linux/mount.h>
1449 #include <linux/kernel.h>
1450 +#include <linux/string.h>
1452 +#define IT_OPEN 0x0001
1453 +#define IT_CREAT 0x0002
1454 +#define IT_READDIR 0x0004
1455 +#define IT_GETATTR 0x0008
1456 +#define IT_LOOKUP 0x0010
1457 +#define IT_UNLINK 0x0020
1458 +#define IT_GETXATTR 0x0040
1459 +#define IT_EXEC 0x0080
1460 +#define IT_PIN 0x0100
1462 +#define IT_FL_LOCKED 0x0001
1463 +#define IT_FL_FOLLOWED 0x0002 /* set by vfs_follow_link */
1465 +#define INTENT_MAGIC 0x19620323
1467 +struct lookup_intent {
1469 + void (*it_op_release)(struct lookup_intent *);
1473 + int it_disposition;
1476 + __u64 it_lock_handle[2];
1481 +static inline void intent_init(struct lookup_intent *it, int op, int flags)
1483 + memset(it, 0, sizeof(*it));
1484 + it->it_magic = INTENT_MAGIC;
1486 + it->it_flags = flags;
1491 * linux/include/linux/dcache.h
1492 @@ -96,8 +135,22 @@ struct dentry_operations {
1493 int (*d_delete)(struct dentry *);
1494 void (*d_release)(struct dentry *);
1495 void (*d_iput)(struct dentry *, struct inode *);
1496 + int (*d_revalidate_it)(struct dentry *, int, struct lookup_intent *);
1497 + void (*d_pin)(struct dentry *, struct vfsmount * , int);
1498 + void (*d_unpin)(struct dentry *, struct vfsmount *, int);
1501 +#define PIN(de,mnt,flag) if (de->d_op && de->d_op->d_pin) \
1502 + de->d_op->d_pin(de, mnt, flag);
1503 +#define UNPIN(de,mnt,flag) if (de->d_op && de->d_op->d_unpin) \
1504 + de->d_op->d_unpin(de, mnt, flag);
1507 +/* defined in fs/namei.c */
1508 +extern void intent_release(struct lookup_intent *it);
1509 +/* defined in fs/dcache.c */
1510 +extern void __d_rehash(struct dentry * entry, int lock);
1512 /* the dentry parameter passed to d_hash and d_compare is the parent
1513 * directory of the entries to be compared. It is used in case these
1514 * functions need any directory specific information for determining
1515 @@ -129,6 +182,7 @@ d_iput: no no yes
1516 * s_nfsd_free_path semaphore will be down
1518 #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
1519 +#define DCACHE_LUSTRE_INVALID 0x0010 /* Lustre invalidated */
1521 extern spinlock_t dcache_lock;
1523 --- linux-2.4.20/include/linux/fs.h~vfs_intent-2.4.20-rh 2003-07-17 08:34:44.000000000 -0700
1524 +++ linux-2.4.20-mmonroe/include/linux/fs.h 2003-07-17 08:35:22.000000000 -0700
1525 @@ -337,6 +337,9 @@ extern void set_bh_page(struct buffer_he
1526 #define ATTR_MTIME_SET 256
1527 #define ATTR_FORCE 512 /* Not a change, but a change it */
1528 #define ATTR_ATTR_FLAG 1024
1529 +#define ATTR_RAW 0x0800 /* file system, not vfs will massage attrs */
1530 +#define ATTR_FROM_OPEN 0x1000 /* called from open path, ie O_TRUNC */
1531 +#define ATTR_CTIME_SET 0x2000
1534 * This is the Inode Attributes structure, used for notify_change(). It
1535 @@ -574,6 +577,7 @@ struct file {
1537 /* needed for tty driver, and maybe others */
1539 + struct lookup_intent *f_it;
1541 /* preallocated helper kiobuf to speedup O_DIRECT */
1542 struct kiobuf *f_iobuf;
1543 @@ -701,6 +705,7 @@ struct nameidata {
1547 + struct lookup_intent *it;
1551 @@ -821,7 +826,8 @@ extern int vfs_symlink(struct inode *, s
1552 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1553 extern int vfs_rmdir(struct inode *, struct dentry *);
1554 extern int vfs_unlink(struct inode *, struct dentry *);
1555 -extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
1556 +int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1557 + struct inode *new_dir, struct dentry *new_dentry);
1561 @@ -881,21 +887,32 @@ struct file_operations {
1563 struct inode_operations {
1564 int (*create) (struct inode *,struct dentry *,int);
1565 + int (*create_it) (struct inode *,struct dentry *,int, struct lookup_intent *);
1566 struct dentry * (*lookup) (struct inode *,struct dentry *);
1567 + struct dentry * (*lookup_it) (struct inode *,struct dentry *, struct lookup_intent *, int flags);
1568 int (*link) (struct dentry *,struct inode *,struct dentry *);
1569 + int (*link_raw) (struct nameidata *,struct nameidata *);
1570 int (*unlink) (struct inode *,struct dentry *);
1571 + int (*unlink_raw) (struct nameidata *);
1572 int (*symlink) (struct inode *,struct dentry *,const char *);
1573 + int (*symlink_raw) (struct nameidata *,const char *);
1574 int (*mkdir) (struct inode *,struct dentry *,int);
1575 + int (*mkdir_raw) (struct nameidata *,int);
1576 int (*rmdir) (struct inode *,struct dentry *);
1577 + int (*rmdir_raw) (struct nameidata *);
1578 int (*mknod) (struct inode *,struct dentry *,int,int);
1579 + int (*mknod_raw) (struct nameidata *,int,dev_t);
1580 int (*rename) (struct inode *, struct dentry *,
1581 struct inode *, struct dentry *);
1582 + int (*rename_raw) (struct nameidata *, struct nameidata *);
1583 int (*readlink) (struct dentry *, char *,int);
1584 int (*follow_link) (struct dentry *, struct nameidata *);
1585 void (*truncate) (struct inode *);
1586 int (*permission) (struct inode *, int);
1587 int (*revalidate) (struct dentry *);
1588 + int (*revalidate_it) (struct dentry *, struct lookup_intent *);
1589 int (*setattr) (struct dentry *, struct iattr *);
1590 + int (*setattr_raw) (struct inode *, struct iattr *);
1591 int (*getattr) (struct dentry *, struct iattr *);
1592 int (*setxattr) (struct dentry *, const char *, void *, size_t, int);
1593 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
1594 @@ -1091,10 +1108,14 @@ static inline int get_lease(struct inode
1596 asmlinkage long sys_open(const char *, int, int);
1597 asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
1598 -extern int do_truncate(struct dentry *, loff_t start);
1599 +extern int do_truncate(struct dentry *, loff_t start, int called_from_open);
1601 extern struct file *filp_open(const char *, int, int);
1602 extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
1603 +extern int open_namei_it(const char *filename, int namei_flags, int mode,
1604 + struct nameidata *nd, struct lookup_intent *it);
1605 +extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1606 + int flags, struct lookup_intent *it);
1607 extern int filp_close(struct file *, fl_owner_t id);
1608 extern char * getname(const char *);
1610 @@ -1385,6 +1406,7 @@ typedef int (*read_actor_t)(read_descrip
1611 extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
1613 extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
1614 +extern int FASTCALL(__user_walk_it(const char *, unsigned, struct nameidata *, struct lookup_intent *it));
1615 extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
1616 extern int FASTCALL(path_walk(const char *, struct nameidata *));
1617 extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
1618 @@ -1396,6 +1418,8 @@ extern struct dentry * lookup_one_len(co
1619 extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
1620 #define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
1621 #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
1622 +#define user_path_walk_it(name,nd,it) __user_walk_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd, it)
1623 +#define user_path_walk_link_it(name,nd,it) __user_walk_it(name, LOOKUP_POSITIVE, nd, it)
1625 extern void inode_init_once(struct inode *);
1626 extern void iput(struct inode *);
1627 @@ -1497,6 +1521,8 @@ extern struct file_operations generic_ro
1629 extern int vfs_readlink(struct dentry *, char *, int, const char *);
1630 extern int vfs_follow_link(struct nameidata *, const char *);
1631 +extern int vfs_follow_link_it(struct nameidata *, const char *,
1632 + struct lookup_intent *it);
1633 extern int page_readlink(struct dentry *, char *, int);
1634 extern int page_follow_link(struct dentry *, struct nameidata *);
1635 extern struct inode_operations page_symlink_inode_operations;
1636 --- linux-2.4.20/kernel/ksyms.c~vfs_intent-2.4.20-rh 2003-07-17 08:34:45.000000000 -0700
1637 +++ linux-2.4.20-mmonroe/kernel/ksyms.c 2003-07-17 08:35:22.000000000 -0700
1638 @@ -298,6 +298,7 @@ EXPORT_SYMBOL(read_cache_page);
1639 EXPORT_SYMBOL(set_page_dirty);
1640 EXPORT_SYMBOL(vfs_readlink);
1641 EXPORT_SYMBOL(vfs_follow_link);
1642 +EXPORT_SYMBOL(vfs_follow_link_it);
1643 EXPORT_SYMBOL(page_readlink);
1644 EXPORT_SYMBOL(page_follow_link);
1645 EXPORT_SYMBOL(page_symlink_inode_operations);