3 fs/namei.c | 295 +++++++++++++++++++++++++++++++++++++++-------
4 fs/namespace.c | 28 +++-
5 fs/open.c | 172 +++++++++++++++++++-------
6 fs/stat.c | 52 +++++---
7 include/linux/dcache.h | 60 +++++++++
8 include/linux/fs.h | 32 ++++
9 include/linux/fs_struct.h | 4
13 12 files changed, 558 insertions(+), 128 deletions(-)
15 Index: linux-2.4.19.SuSE/fs/dcache.c
16 ===================================================================
17 --- linux-2.4.19.SuSE.orig/fs/dcache.c Mon Jan 27 05:08:04 2003
18 +++ linux-2.4.19.SuSE/fs/dcache.c Sat Nov 15 17:29:03 2003
20 spin_unlock(&dcache_lock);
24 + /* network invalidation by Lustre */
25 + if (dentry->d_flags & DCACHE_LUSTRE_INVALID) {
26 + spin_unlock(&dcache_lock);
31 * Check whether to do a partial shrink_dcache
32 * to get rid of unused child entries.
34 * Adds a dentry to the hash according to its name.
37 -void d_rehash(struct dentry * entry)
38 +void __d_rehash(struct dentry * entry, int lock)
40 struct list_head *list = d_hash(entry->d_parent, entry->d_name.hash);
41 if (!list_empty(&entry->d_hash)) BUG();
42 - spin_lock(&dcache_lock);
43 + if (lock) spin_lock(&dcache_lock);
44 list_add(&entry->d_hash, list);
45 - spin_unlock(&dcache_lock);
46 + if (lock) spin_unlock(&dcache_lock);
48 +EXPORT_SYMBOL(__d_rehash);
50 +void d_rehash(struct dentry * entry)
52 + __d_rehash(entry, 1);
55 #define do_switch(x,y) do { \
56 Index: linux-2.4.19.SuSE/fs/exec.c
57 ===================================================================
58 --- linux-2.4.19.SuSE.orig/fs/exec.c Mon Jan 27 05:08:35 2003
59 +++ linux-2.4.19.SuSE/fs/exec.c Sat Nov 15 17:34:06 2003
64 + struct lookup_intent it = { .it_op = IT_OPEN,
65 + .it_flags = FMODE_READ|FMODE_EXEC };
67 - error = user_path_walk(library, &nd);
68 + error = user_path_walk_it(library, &nd, &it);
76 - file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
77 + file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it);
78 + intent_release(&it);
79 error = PTR_ERR(file);
86 + struct lookup_intent it = { .it_op = IT_OPEN,
87 + .it_flags = FMODE_READ|FMODE_EXEC };
89 if (path_init(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd))
90 - err = path_walk(name, &nd);
91 + err = path_walk_it(name, &nd, &it);
94 inode = nd.dentry->d_inode;
99 - file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
100 + file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it);
101 + intent_release(&it);
103 err = deny_write_access(file);
109 + intent_release(&it);
115 if (!file->f_op->write)
117 - if (do_truncate(file->f_dentry, 0) != 0)
118 + if (do_truncate(file->f_dentry, 0, 0) != 0)
121 retval = binfmt->core_dump(signr, regs, file);
122 Index: linux-2.4.19.SuSE/fs/namei.c
123 ===================================================================
124 --- linux-2.4.19.SuSE.orig/fs/namei.c Mon Jan 27 05:08:07 2003
125 +++ linux-2.4.19.SuSE/fs/namei.c Sat Nov 15 17:52:03 2003
127 * XEmacs seems to be relying on it...
130 +void intent_release(struct lookup_intent *it)
132 + if (it && it->it_op_release)
133 + it->it_op_release(it);
137 /* In order to reduce some races, while at the same time doing additional
138 * checking and hopefully speeding things up, we copy filenames to the
139 * kernel data space before using them..
140 @@ -260,10 +267,19 @@
141 * Internal lookup() using the new generic dcache.
144 -static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name, int flags)
145 +static struct dentry *cached_lookup(struct dentry *parent, struct qstr *name,
146 + int flags, struct lookup_intent *it)
148 struct dentry * dentry = d_lookup(parent, name);
150 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
151 + if (!dentry->d_op->d_revalidate_it(dentry, flags, NULL, it) &&
152 + !d_invalidate(dentry)) {
158 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
159 if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) {
161 @@ -281,11 +297,15 @@
162 * make sure that nobody added the entry to the dcache in the meantime..
165 -static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, int flags)
166 +static struct dentry *real_lookup(struct dentry *parent, struct qstr *name,
167 + int flags, struct lookup_intent *it)
169 struct dentry * result;
170 struct inode *dir = parent->d_inode;
177 * First re-do the cached lookup just in case it was created
179 result = ERR_PTR(-ENOMEM);
182 + if (dir->i_op->lookup_it)
183 + result = dir->i_op->lookup_it(dir, dentry, NULL, it, flags);
185 result = dir->i_op->lookup(dir, dentry);
190 result = ERR_PTR(-ENOENT);
192 + } else if (result->d_op && result->d_op->d_revalidate_it) {
193 + if (!result->d_op->d_revalidate_it(result, flags, NULL, it) &&
194 + !d_invalidate(result)) {
197 + result = ERR_PTR(-ESTALE);
198 + if (!IS_ERR(result))
205 * Without that kind of total limit, nasty chains of consecutive
206 * symlinks can cause almost arbitrarily long lookups.
208 -static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
209 +static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd,
210 + struct lookup_intent *it)
213 if (current->link_count >= 8)
214 @@ -346,10 +379,12 @@
215 current->link_count++;
216 current->total_link_count++;
217 UPDATE_ATIME(dentry->d_inode);
219 err = dentry->d_inode->i_op->follow_link(dentry, nd);
220 current->link_count--;
223 + intent_release(it);
229 * We expect 'base' to be positive and a directory.
231 -int link_path_walk(const char * name, struct nameidata *nd)
232 +int link_path_walk_it(const char *name, struct nameidata *nd,
233 + struct lookup_intent *it)
235 struct dentry *dentry;
237 @@ -524,12 +560,13 @@
240 /* This does the actual lookups.. */
241 - dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
242 + dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE, NULL);
244 err = -EWOULDBLOCKIO;
247 - dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
248 + dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE,
250 err = PTR_ERR(dentry);
256 if (inode->i_op->follow_link) {
257 - err = do_follow_link(dentry, nd);
258 + err = do_follow_link(dentry, nd, NULL);
266 - if (!inode->i_op->lookup)
267 + if (!inode->i_op->lookup && !inode->i_op->lookup_it)
270 /* here ends the main loop */
271 @@ -590,12 +627,12 @@
275 - dentry = cached_lookup(nd->dentry, &this, 0);
276 + dentry = cached_lookup(nd->dentry, &this, 0, it);
278 err = -EWOULDBLOCKIO;
281 - dentry = real_lookup(nd->dentry, &this, 0);
282 + dentry = real_lookup(nd->dentry, &this, 0, it);
283 err = PTR_ERR(dentry);
287 inode = dentry->d_inode;
288 if ((lookup_flags & LOOKUP_FOLLOW)
289 && inode && inode->i_op && inode->i_op->follow_link) {
290 - err = do_follow_link(dentry, nd);
291 + err = do_follow_link(dentry, nd, it);
297 if (lookup_flags & LOOKUP_DIRECTORY) {
299 - if (!inode->i_op || !inode->i_op->lookup)
300 + if (!inode->i_op ||
301 + (!inode->i_op->lookup && !inode->i_op->lookup_it))
306 * Check the cached dentry for staleness.
309 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
311 + if (!dentry->d_op->d_revalidate_it(dentry, 0, NULL, it)) {
312 + struct dentry *new;
313 + err = permission(dentry->d_parent->d_inode,
317 + new = real_lookup(dentry->d_parent,
318 + &dentry->d_name, 0, it);
320 + err = PTR_ERR(new);
323 + d_invalidate(dentry);
327 + if (!nd->dentry->d_inode)
330 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
332 if (!dentry->d_op->d_revalidate(dentry, lookup_flags & LOOKUP_PARENT)) {
333 @@ -656,15 +713,28 @@
338 + intent_release(it);
344 +int link_path_walk(const char * name, struct nameidata *nd)
346 + return link_path_walk_it(name, nd, NULL);
349 +int path_walk_it(const char * name, struct nameidata *nd, struct lookup_intent *it)
351 + current->total_link_count = 0;
352 + return link_path_walk_it(name, nd, it);
355 int path_walk(const char * name, struct nameidata *nd)
357 current->total_link_count = 0;
358 - return link_path_walk(name, nd);
359 + return link_path_walk_it(name, nd, NULL);
365 nd->last_type = LAST_ROOT; /* if there are only slashes... */
369 return walk_init_root(name,nd);
370 read_lock(¤t->fs->lock);
372 * needs parent already locked. Doesn't follow mounts.
375 -struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
376 +struct dentry * lookup_hash_it(struct qstr *name, struct dentry * base,
377 + struct lookup_intent *it)
379 struct dentry * dentry;
381 @@ -790,13 +862,16 @@
385 - dentry = cached_lookup(base, name, 0);
386 + dentry = cached_lookup(base, name, 0, it);
388 struct dentry *new = d_alloc(base, name);
389 dentry = ERR_PTR(-ENOMEM);
393 + if (inode->i_op->lookup_it)
394 + dentry = inode->i_op->lookup_it(inode, new, NULL, it, 0);
396 dentry = inode->i_op->lookup(inode, new);
403 +struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
405 + return lookup_hash_it(name, base, NULL);
410 struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
414 this.hash = end_name_hash(hash);
416 - return lookup_hash(&this, base);
417 + return lookup_hash_it(&this, base, NULL);
419 return ERR_PTR(-EACCES);
425 +int __user_walk_it(const char *name, unsigned flags, struct nameidata *nd,
426 + struct lookup_intent *it)
431 + tmp = getname(name);
432 + err = PTR_ERR(tmp);
433 + if (!IS_ERR(tmp)) {
435 + if (path_init(tmp, flags, nd))
436 + err = path_walk_it(tmp, nd, it);
443 * It's inline, so penalty for filesystems that don't use sticky bit is
449 -int vfs_create(struct inode *dir, struct dentry *dentry, int mode)
450 +static int vfs_create_it(struct inode *dir, struct dentry *dentry, int mode,
451 + struct lookup_intent *it)
455 @@ -971,12 +1070,15 @@
458 error = -EACCES; /* shouldn't it be ENOSYS? */
459 - if (!dir->i_op || !dir->i_op->create)
460 + if (!dir->i_op || (!dir->i_op->create && !dir->i_op->create_it))
465 - error = dir->i_op->create(dir, dentry, mode);
466 + if (dir->i_op->create_it)
467 + error = dir->i_op->create_it(dir, dentry, mode, it);
469 + error = dir->i_op->create(dir, dentry, mode);
473 @@ -985,6 +1087,11 @@
477 +int vfs_create(struct inode *dir, struct dentry *dentry, int mode)
479 + return vfs_create_it(dir, dentry, mode, NULL);
486 * for symlinks (where the permissions are checked later).
489 -int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
490 +int open_namei_it(const char *pathname, int flag, int mode,
491 + struct nameidata *nd, struct lookup_intent *it)
493 int acc_mode, error = 0;
495 @@ -1009,12 +1117,14 @@
497 acc_mode = ACC_MODE(flag);
500 + it->it_flags = flag;
502 * The simplest case - just a plain lookup.
504 if (!(flag & O_CREAT)) {
505 if (path_init(pathname, lookup_flags(flag), nd))
506 - error = path_walk(pathname, nd);
507 + error = path_walk_it(pathname, nd, it);
511 @@ -1024,6 +1134,10 @@
513 * Create - we need to know the parent.
516 + it->it_create_mode = mode;
517 + it->it_op |= IT_CREAT;
519 if (path_init(pathname, LOOKUP_PARENT, nd))
520 error = path_walk(pathname, nd);
522 @@ -1040,7 +1154,7 @@
525 down(&dir->d_inode->i_sem);
526 - dentry = lookup_hash(&nd->last, nd->dentry);
527 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
530 error = PTR_ERR(dentry);
531 @@ -1049,11 +1163,13 @@
535 + it->it_create_mode = mode;
536 /* Negative dentry, just create the file */
537 if (!dentry->d_inode) {
538 if (!IS_POSIXACL(dir->d_inode))
539 mode &= ~current->fs->umask;
540 - error = vfs_create(dir->d_inode, dentry, mode);
541 + error = vfs_create_it(dir->d_inode, dentry,
542 + mode & ~current->fs->umask, it);
543 up(&dir->d_inode->i_sem);
544 #ifndef DENTRY_WASTE_RAM
546 @@ -1161,7 +1277,7 @@
550 - error = do_truncate(dentry, 0);
551 + error = do_truncate(dentry, 0, 1);
553 put_write_access(inode);
555 @@ -1173,8 +1289,10 @@
559 + intent_release(it);
562 + intent_release(it);
566 @@ -1193,7 +1311,10 @@
567 * are done. Procfs-like symlinks just set LAST_BIND.
569 UPDATE_ATIME(dentry->d_inode);
571 error = dentry->d_inode->i_op->follow_link(dentry, nd);
573 + intent_release(it);
577 @@ -1215,13 +1336,20 @@
580 down(&dir->d_inode->i_sem);
581 - dentry = lookup_hash(&nd->last, nd->dentry);
582 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
583 putname(nd->last.name);
587 +int open_namei(const char *pathname, int flag, int mode, struct nameidata *nd)
589 + return open_namei_it(pathname, flag, mode, nd, NULL);
594 -static struct dentry *lookup_create(struct nameidata *nd, int is_dir)
595 +struct dentry *lookup_create(struct nameidata *nd, int is_dir,
596 + struct lookup_intent *it)
598 struct dentry *dentry;
600 @@ -1229,7 +1357,7 @@
601 dentry = ERR_PTR(-EEXIST);
602 if (nd->last_type != LAST_NORM)
604 - dentry = lookup_hash(&nd->last, nd->dentry);
605 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
608 if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
609 @@ -1286,7 +1414,20 @@
610 error = path_walk(tmp, &nd);
613 - dentry = lookup_create(&nd, 0);
615 + if (nd.last_type != LAST_NORM) {
619 + if (nd.dentry->d_inode->i_op->mknod_raw) {
620 + struct inode_operations *op = nd.dentry->d_inode->i_op;
621 + error = op->mknod_raw(&nd, mode, dev);
622 + /* the file system wants to use normal vfs path now */
623 + if (error != -EOPNOTSUPP)
627 + dentry = lookup_create(&nd, 0, NULL);
628 error = PTR_ERR(dentry);
630 if (!IS_POSIXACL(nd.dentry->d_inode))
631 @@ -1308,6 +1445,7 @@
634 up(&nd.dentry->d_inode->i_sem);
639 @@ -1356,7 +1494,18 @@
640 error = path_walk(tmp, &nd);
643 - dentry = lookup_create(&nd, 1);
644 + if (nd.last_type != LAST_NORM) {
648 + if (nd.dentry->d_inode->i_op->mkdir_raw) {
649 + struct inode_operations *op = nd.dentry->d_inode->i_op;
650 + error = op->mkdir_raw(&nd, mode);
651 + /* the file system wants to use normal vfs path now */
652 + if (error != -EOPNOTSUPP)
655 + dentry = lookup_create(&nd, 1, NULL);
656 error = PTR_ERR(dentry);
657 if (!IS_ERR(dentry)) {
658 if (!IS_POSIXACL(nd.dentry->d_inode))
659 @@ -1365,6 +1510,7 @@
662 up(&nd.dentry->d_inode->i_sem);
667 @@ -1466,8 +1612,16 @@
671 + if (nd.dentry->d_inode->i_op->rmdir_raw) {
672 + struct inode_operations *op = nd.dentry->d_inode->i_op;
674 + error = op->rmdir_raw(&nd);
675 + /* the file system wants to use normal vfs path now */
676 + if (error != -EOPNOTSUPP)
679 down(&nd.dentry->d_inode->i_sem);
680 - dentry = lookup_hash(&nd.last, nd.dentry);
681 + dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
682 error = PTR_ERR(dentry);
683 if (!IS_ERR(dentry)) {
684 error = vfs_rmdir(nd.dentry->d_inode, dentry);
685 @@ -1526,8 +1680,15 @@
687 if (nd.last_type != LAST_NORM)
689 + if (nd.dentry->d_inode->i_op->unlink_raw) {
690 + struct inode_operations *op = nd.dentry->d_inode->i_op;
691 + error = op->unlink_raw(&nd);
692 + /* the file system wants to use normal vfs path now */
693 + if (error != -EOPNOTSUPP)
696 down(&nd.dentry->d_inode->i_sem);
697 - dentry = lookup_hash(&nd.last, nd.dentry);
698 + dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
699 error = PTR_ERR(dentry);
700 if (!IS_ERR(dentry)) {
701 /* Why not before? Because we want correct error value */
702 @@ -1595,15 +1756,27 @@
703 error = path_walk(to, &nd);
706 - dentry = lookup_create(&nd, 0);
707 + if (nd.last_type != LAST_NORM) {
711 + if (nd.dentry->d_inode->i_op->symlink_raw) {
712 + struct inode_operations *op = nd.dentry->d_inode->i_op;
713 + error = op->symlink_raw(&nd, from);
714 + /* the file system wants to use normal vfs path now */
715 + if (error != -EOPNOTSUPP)
718 + dentry = lookup_create(&nd, 0, NULL);
719 error = PTR_ERR(dentry);
720 if (!IS_ERR(dentry)) {
721 error = vfs_symlink(nd.dentry->d_inode, dentry, from);
724 up(&nd.dentry->d_inode->i_sem);
732 @@ -1686,7 +1855,14 @@
734 if (old_nd.mnt != nd.mnt)
736 - new_dentry = lookup_create(&nd, 0);
737 + if (nd.last_type != LAST_NORM) {
741 + if (nd.dentry->d_inode->i_op->link_raw) {
742 + struct inode_operations *op = nd.dentry->d_inode->i_op;
743 + error = op->link_raw(&old_nd, &nd);
744 + /* the file system wants to use normal vfs path now */
745 + if (error != -EOPNOTSUPP)
748 + new_dentry = lookup_create(&nd, 0, NULL);
749 error = PTR_ERR(new_dentry);
750 if (!IS_ERR(new_dentry)) {
751 error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
752 @@ -1732,7 +1908,7 @@
755 int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
756 - struct inode *new_dir, struct dentry *new_dentry)
757 + struct inode *new_dir, struct dentry *new_dentry)
760 struct inode *target;
761 @@ -1811,7 +1987,7 @@
764 int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
765 - struct inode *new_dir, struct dentry *new_dentry)
766 + struct inode *new_dir, struct dentry *new_dentry)
770 @@ -1902,9 +2078,18 @@
771 if (newnd.last_type != LAST_NORM)
774 + if (old_dir->d_inode->i_op->rename_raw) {
776 + error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
778 + /* the file system wants to use normal vfs path now */
779 + if (error != -EOPNOTSUPP)
783 double_lock(new_dir, old_dir);
785 - old_dentry = lookup_hash(&oldnd.last, old_dir);
786 + old_dentry = lookup_hash_it(&oldnd.last, old_dir, NULL);
787 error = PTR_ERR(old_dentry);
788 if (IS_ERR(old_dentry))
790 @@ -1920,16 +2105,16 @@
791 if (newnd.last.name[newnd.last.len])
794 - new_dentry = lookup_hash(&newnd.last, new_dir);
795 + new_dentry = lookup_hash_it(&newnd.last, new_dir, NULL);
796 error = PTR_ERR(new_dentry);
797 if (IS_ERR(new_dentry))
802 error = vfs_rename(old_dir->d_inode, old_dentry,
803 new_dir->d_inode, new_dentry);
809 @@ -1980,20 +2165,26 @@
813 -__vfs_follow_link(struct nameidata *nd, const char *link)
814 +__vfs_follow_link(struct nameidata *nd, const char *link,
815 + struct lookup_intent *it)
824 + else if (it != nd->intent)
825 + printk("it != nd->intent: tell phil@clusterfs.com\n");
829 if (!walk_init_root(link, nd))
830 /* weird __emul_prefix() stuff did it */
833 - res = link_path_walk(link, nd);
834 + res = link_path_walk_it(link, nd, it);
836 if (current->link_count || res || nd->last_type!=LAST_NORM)
838 @@ -2015,7 +2206,13 @@
840 int vfs_follow_link(struct nameidata *nd, const char *link)
842 - return __vfs_follow_link(nd, link);
843 + return __vfs_follow_link(nd, link, NULL);
846 +int vfs_follow_link_it(struct nameidata *nd, const char *link,
847 + struct lookup_intent *it)
849 + return __vfs_follow_link(nd, link, it);
852 /* get the link contents into pagecache */
853 @@ -2057,7 +2254,7 @@
855 struct page *page = NULL;
856 char *s = page_getlink(dentry, &page);
857 - int res = __vfs_follow_link(nd, s);
858 + int res = __vfs_follow_link(nd, s, NULL);
861 page_cache_release(page);
862 Index: linux-2.4.19.SuSE/fs/namespace.c
863 ===================================================================
864 --- linux-2.4.19.SuSE.orig/fs/namespace.c Mon Jan 27 05:08:07 2003
865 +++ linux-2.4.19.SuSE/fs/namespace.c Sat Nov 15 17:56:42 2003
868 old_nd->dentry = mnt->mnt_mountpoint;
869 old_nd->mnt = mnt->mnt_parent;
870 + UNPIN(old_nd->dentry, old_nd->mnt, 1);
871 mnt->mnt_parent = mnt;
872 mnt->mnt_mountpoint = mnt->mnt_root;
873 list_del_init(&mnt->mnt_child);
876 mnt->mnt_parent = mntget(nd->mnt);
877 mnt->mnt_mountpoint = dget(nd->dentry);
878 + PIN(nd->dentry, nd->mnt, 1);
879 list_add(&mnt->mnt_hash, mount_hashtable+hash(nd->mnt, nd->dentry));
880 list_add(&mnt->mnt_child, &nd->mnt->mnt_mounts);
881 nd->dentry->d_mounted++;
886 -static int do_umount(struct vfsmount *mnt, int flags)
887 +int do_umount(struct vfsmount *mnt, int flags)
889 struct super_block * sb = mnt->mnt_sb;
891 @@ -491,15 +493,18 @@
893 struct nameidata old_nd;
894 struct vfsmount *mnt = NULL;
895 + struct lookup_intent it = { .it_op = IT_GETATTR };
896 int err = mount_is_safe(nd);
899 if (!old_name || !*old_name)
901 if (path_init(old_name, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &old_nd))
902 - err = path_walk(old_name, &old_nd);
904 + err = path_walk_it(old_name, &old_nd, &it);
906 + intent_release(&it);
910 down_write(¤t->namespace->sem);
915 up_write(¤t->namespace->sem);
916 + intent_release(&it);
917 path_release(&old_nd);
921 unsigned long flags, void *data_page)
924 + struct lookup_intent it = { .it_op = IT_GETATTR };
930 /* ... and get the mountpoint */
931 if (path_init(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd))
932 - retval = path_walk(dir_name, &nd);
934 + retval = path_walk_it(dir_name, &nd, &it);
936 + intent_release(&it);
940 if (flags & MS_REMOUNT)
941 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
944 retval = do_add_mount(&nd, type_page, flags, mnt_flags,
945 dev_name, data_page);
947 + intent_release(&it);
953 struct vfsmount *tmp;
954 struct nameidata new_nd, old_nd, parent_nd, root_parent, user_nd;
955 + struct lookup_intent new_it = { .it_op = IT_GETATTR };
956 + struct lookup_intent old_it = { .it_op = IT_GETATTR };
963 if (path_init(name, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &new_nd))
964 - error = path_walk(name, &new_nd);
965 + error = path_walk_it(name, &new_nd, &new_it);
972 if (path_init(name, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &old_nd))
973 - error = path_walk(name, &old_nd);
974 + error = path_walk_it(name, &old_nd, &old_it);
978 @@ -1013,8 +1026,10 @@
979 up(&old_nd.dentry->d_inode->i_zombie);
980 up_write(¤t->namespace->sem);
981 path_release(&user_nd);
982 + intent_release(&old_it);
983 path_release(&old_nd);
985 + intent_release(&new_it);
986 path_release(&new_nd);
989 Index: linux-2.4.19.SuSE/fs/open.c
990 ===================================================================
991 --- linux-2.4.19.SuSE.orig/fs/open.c Mon Jan 27 05:08:00 2003
992 +++ linux-2.4.19.SuSE/fs/open.c Sat Nov 15 17:43:27 2003
994 #include <asm/uaccess.h>
996 #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
997 +extern int path_walk_it(const char *name, struct nameidata *nd,
998 + struct lookup_intent *it);
1000 int vfs_statfs(struct super_block *sb, struct statfs *buf)
1003 write_unlock(&files->file_lock);
1006 -int do_truncate(struct dentry *dentry, loff_t length)
1007 +int do_truncate(struct dentry *dentry, loff_t length, int called_from_open)
1009 struct inode *inode = dentry->d_inode;
1010 + struct inode_operations *op = dentry->d_inode->i_op;
1012 struct iattr newattrs;
1014 @@ -108,7 +111,13 @@
1015 down(&inode->i_sem);
1016 newattrs.ia_size = length;
1017 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
1018 - error = notify_change(dentry, &newattrs);
1019 + if (called_from_open)
1020 + newattrs.ia_valid |= ATTR_FROM_OPEN;
1021 + if (op->setattr_raw) {
1022 + newattrs.ia_valid |= ATTR_RAW;
1023 + error = op->setattr_raw(inode, &newattrs);
1025 + error = notify_change(dentry, &newattrs);
1029 @@ -118,12 +127,13 @@
1030 struct nameidata nd;
1031 struct inode * inode;
1033 + struct lookup_intent it = { .it_op = IT_GETATTR };
1036 if (length < 0) /* sorry, but loff_t says... */
1039 - error = user_path_walk(path, &nd);
1040 + error = user_path_walk_it(path, &nd, &it);
1043 inode = nd.dentry->d_inode;
1044 @@ -163,11 +173,13 @@
1045 error = locks_verify_truncate(inode, NULL, length);
1048 - error = do_truncate(nd.dentry, length);
1049 + intent_release(&it);
1050 + error = do_truncate(nd.dentry, length, 0);
1052 put_write_access(inode);
1055 + intent_release(&it);
1061 error = locks_verify_truncate(inode, file, length);
1063 - error = do_truncate(dentry, length);
1064 + error = do_truncate(dentry, length, 0);
1068 @@ -260,11 +272,13 @@
1069 struct inode * inode;
1070 struct iattr newattrs;
1072 - error = user_path_walk(filename, &nd);
1073 + error = user_path_walk_it(filename, &nd, NULL);
1076 inode = nd.dentry->d_inode;
1078 + /* this is safe without a Lustre lock because it only depends
1079 + on the super block */
1081 if (IS_RDONLY(inode))
1083 @@ -279,11 +293,25 @@
1086 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
1090 + if (inode->i_op->setattr_raw) {
1091 + struct inode_operations *op = nd.dentry->d_inode->i_op;
1093 + newattrs.ia_valid |= ATTR_RAW;
1094 + error = op->setattr_raw(inode, &newattrs);
1095 + /* the file system wants to use normal vfs path now */
1096 + if (error != -EOPNOTSUPP)
1097 + goto dput_and_out;
1102 if (current->fsuid != inode->i_uid &&
1103 (error = permission(inode,MAY_WRITE)) != 0)
1107 error = notify_change(nd.dentry, &newattrs);
1110 @@ -304,12 +332,14 @@
1111 struct inode * inode;
1112 struct iattr newattrs;
1114 - error = user_path_walk(filename, &nd);
1115 + 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 @@ -324,7 +354,20 @@
1127 newattrs.ia_atime = times[0].tv_sec;
1128 newattrs.ia_mtime = times[1].tv_sec;
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)
1149 int old_fsuid, old_fsgid;
1150 kernel_cap_t old_cap;
1152 + struct lookup_intent it = { .it_op = IT_GETATTR };
1154 if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
1156 @@ -364,13 +408,14 @@
1158 current->cap_effective = current->cap_permitted;
1160 - res = user_path_walk(filename, &nd);
1161 + res = user_path_walk_it(filename, &nd, &it);
1163 res = permission(nd.dentry->d_inode, mode);
1164 /* SuS v2 requires we report a read only fs too */
1165 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
1166 && !special_file(nd.dentry->d_inode->i_mode))
1168 + intent_release(&it);
1174 struct nameidata nd;
1176 + struct lookup_intent it = { .it_op = IT_GETATTR };
1178 name = getname(filename);
1179 error = PTR_ERR(name);
1183 if (path_init(name,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd))
1184 - error = path_walk(name, &nd);
1185 + error = path_walk_it(name, &nd, &it);
1190 set_fs_pwd(current->fs, nd.mnt, nd.dentry);
1193 + intent_release(&it);
1199 struct nameidata nd;
1201 + struct lookup_intent it = { .it_op = IT_GETATTR };
1203 name = getname(filename);
1204 error = PTR_ERR(name);
1207 path_init(name, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
1208 LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
1209 - error = path_walk(name, &nd);
1210 + error = path_walk_it(name, &nd, &it);
1214 @@ -471,39 +519,56 @@
1218 + intent_release(&it);
1224 -asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
1225 +int chmod_common(struct dentry *dentry, mode_t mode)
1227 - struct inode * inode;
1228 - struct dentry * dentry;
1229 - struct file * file;
1231 + struct inode *inode = dentry->d_inode;
1232 struct iattr newattrs;
1237 + if (IS_RDONLY(inode))
1240 - dentry = file->f_dentry;
1241 - inode = dentry->d_inode;
1242 + if (inode->i_op->setattr_raw) {
1243 + newattrs.ia_mode = mode;
1244 + newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1245 + newattrs.ia_valid |= ATTR_RAW;
1246 + err = inode->i_op->setattr_raw(inode, &newattrs);
1247 + /* the file system wants to use normal vfs path now */
1248 + if (err != -EOPNOTSUPP)
1253 - if (IS_RDONLY(inode))
1256 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1260 if (mode == (mode_t) -1)
1261 mode = inode->i_mode;
1262 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
1263 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1264 err = notify_change(dentry, &newattrs);
1271 +asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
1273 + struct file * file;
1280 + err = chmod_common(file->f_dentry, mode);
1285 @@ -512,30 +577,14 @@
1286 asmlinkage long sys_chmod(const char * filename, mode_t mode)
1288 struct nameidata nd;
1289 - struct inode * inode;
1291 - struct iattr newattrs;
1293 error = user_path_walk(filename, &nd);
1296 - inode = nd.dentry->d_inode;
1299 - if (IS_RDONLY(inode))
1300 - goto dput_and_out;
1303 - if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1304 - goto dput_and_out;
1305 + error = chmod_common(nd.dentry, mode);
1307 - if (mode == (mode_t) -1)
1308 - mode = inode->i_mode;
1309 - newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
1310 - newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1311 - error = notify_change(nd.dentry, &newattrs);
1317 @@ -555,6 +604,20 @@
1319 if (IS_RDONLY(inode))
1322 + if (inode->i_op->setattr_raw) {
1323 + struct inode_operations *op = dentry->d_inode->i_op;
1325 + newattrs.ia_uid = user;
1326 + newattrs.ia_gid = group;
1327 + newattrs.ia_valid = ATTR_UID | ATTR_GID | ATTR_CTIME;
1328 + newattrs.ia_valid |= ATTR_RAW;
1329 + error = op->setattr_raw(inode, &newattrs);
1330 + /* the file system wants to use normal vfs path now */
1331 + if (error != -EOPNOTSUPP)
1336 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1340 int namei_flags, error;
1341 struct nameidata nd;
1342 + struct lookup_intent it = { .it_op = IT_OPEN };
1344 namei_flags = flags;
1345 if ((namei_flags+1) & O_ACCMODE)
1346 @@ -666,14 +730,15 @@
1347 if (namei_flags & O_TRUNC)
1350 - error = open_namei(filename, namei_flags, mode, &nd);
1352 - return dentry_open(nd.dentry, nd.mnt, flags);
1353 + error = open_namei_it(filename, namei_flags, mode, &nd, &it);
1355 + return ERR_PTR(error);
1357 - return ERR_PTR(error);
1358 + return dentry_open_it(nd.dentry, nd.mnt, flags, &it);
1361 -struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1362 +struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1363 + int flags, struct lookup_intent *it)
1366 struct inode *inode;
1370 if (f->f_op && f->f_op->open) {
1372 error = f->f_op->open(inode,f);
1378 !inode->i_mapping->a_ops->direct_IO))
1381 + intent_release(it);
1385 @@ -736,11 +804,17 @@
1389 + intent_release(it);
1392 return ERR_PTR(error);
1395 +struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1397 + return dentry_open_it(dentry, mnt, flags, NULL);
1401 * Find an empty file descriptor entry, and mark it busy.
1403 Index: linux-2.4.19.SuSE/fs/stat.c
1404 ===================================================================
1405 --- linux-2.4.19.SuSE.orig/fs/stat.c Mon Jan 27 05:08:00 2003
1406 +++ linux-2.4.19.SuSE/fs/stat.c Sat Nov 15 17:29:03 2003
1408 * Revalidate the inode. This is required for proper NFS attribute caching.
1410 static __inline__ int
1411 -do_revalidate(struct dentry *dentry)
1412 +do_revalidate(struct dentry *dentry, struct lookup_intent *it)
1414 struct inode * inode = dentry->d_inode;
1415 - if (inode->i_op && inode->i_op->revalidate)
1416 + if (inode->i_op && inode->i_op->revalidate_it)
1417 + return inode->i_op->revalidate_it(dentry, it);
1418 + else if (inode->i_op && inode->i_op->revalidate)
1419 return inode->i_op->revalidate(dentry);
1422 @@ -141,13 +145,15 @@
1423 asmlinkage long sys_stat(char * filename, struct __old_kernel_stat * statbuf)
1425 struct nameidata nd;
1426 + struct lookup_intent it = { .it_op = IT_GETATTR };
1429 - error = user_path_walk(filename, &nd);
1430 + error = user_path_walk_it(filename, &nd, &it);
1432 - error = do_revalidate(nd.dentry);
1433 + error = do_revalidate(nd.dentry, &it);
1435 error = cp_old_stat(nd.dentry->d_inode, statbuf);
1436 + intent_release(&it);
1440 @@ -157,13 +163,15 @@
1441 asmlinkage long sys_newstat(char * filename, struct stat * statbuf)
1443 struct nameidata nd;
1444 + struct lookup_intent it = { .it_op = IT_GETATTR };
1447 - error = user_path_walk(filename, &nd);
1448 + error = user_path_walk_it(filename, &nd, &it);
1450 - error = do_revalidate(nd.dentry);
1451 + error = do_revalidate(nd.dentry, &it);
1453 error = cp_new_stat(nd.dentry->d_inode, statbuf);
1454 + intent_release(&it);
1458 @@ -178,13 +186,15 @@
1459 asmlinkage long sys_lstat(char * filename, struct __old_kernel_stat * statbuf)
1461 struct nameidata nd;
1462 + struct lookup_intent it = { .it_op = IT_GETATTR };
1465 - error = user_path_walk_link(filename, &nd);
1466 + error = user_path_walk_link_it(filename, &nd, &it);
1468 - error = do_revalidate(nd.dentry);
1469 + error = do_revalidate(nd.dentry, &it);
1471 error = cp_old_stat(nd.dentry->d_inode, statbuf);
1472 + intent_release(&it);
1476 @@ -195,13 +205,15 @@
1477 asmlinkage long sys_newlstat(char * filename, struct stat * statbuf)
1479 struct nameidata nd;
1480 + struct lookup_intent it = { .it_op = IT_GETATTR };
1483 - error = user_path_walk_link(filename, &nd);
1484 + error = user_path_walk_link_it(filename, &nd, &it);
1486 - error = do_revalidate(nd.dentry);
1487 + error = do_revalidate(nd.dentry, &it);
1489 error = cp_new_stat(nd.dentry->d_inode, statbuf);
1490 + intent_release(&it);
1496 struct dentry * dentry = f->f_dentry;
1498 - err = do_revalidate(dentry);
1499 + err = do_revalidate(dentry, NULL);
1501 err = cp_old_stat(dentry->d_inode, statbuf);
1505 struct dentry * dentry = f->f_dentry;
1507 - err = do_revalidate(dentry);
1508 + err = do_revalidate(dentry, NULL);
1510 err = cp_new_stat(dentry->d_inode, statbuf);
1515 if (inode->i_op && inode->i_op->readlink &&
1516 - !(error = do_revalidate(nd.dentry))) {
1517 + !(error = do_revalidate(nd.dentry, NULL))) {
1518 UPDATE_ATIME(inode);
1519 error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
1521 @@ -339,12 +351,14 @@
1523 struct nameidata nd;
1525 + struct lookup_intent it = { .it_op = IT_GETATTR };
1527 - error = user_path_walk(filename, &nd);
1528 + error = user_path_walk_it(filename, &nd, &it);
1530 - error = do_revalidate(nd.dentry);
1531 + error = do_revalidate(nd.dentry, &it);
1533 error = cp_new_stat64(nd.dentry->d_inode, statbuf);
1534 + intent_release(&it);
1538 @@ -354,12 +368,14 @@
1540 struct nameidata nd;
1542 + struct lookup_intent it = { .it_op = IT_GETATTR };
1544 - error = user_path_walk_link(filename, &nd);
1545 + error = user_path_walk_link_it(filename, &nd, &it);
1547 - error = do_revalidate(nd.dentry);
1548 + error = do_revalidate(nd.dentry, &it);
1550 error = cp_new_stat64(nd.dentry->d_inode, statbuf);
1551 + intent_release(&it);
1557 struct dentry * dentry = f->f_dentry;
1559 - err = do_revalidate(dentry);
1560 + err = do_revalidate(dentry, NULL);
1562 err = cp_new_stat64(dentry->d_inode, statbuf);
1564 Index: linux-2.4.19.SuSE/include/linux/dcache.h
1565 ===================================================================
1566 --- linux-2.4.19.SuSE.orig/include/linux/dcache.h Mon Jan 27 05:13:15 2003
1567 +++ linux-2.4.19.SuSE/include/linux/dcache.h Sat Nov 15 17:35:46 2003
1570 #include <asm/atomic.h>
1571 #include <linux/mount.h>
1572 +#include <linux/string.h>
1574 +#define IT_OPEN 0x0001
1575 +#define IT_CREAT 0x0002
1576 +#define IT_READDIR 0x0004
1577 +#define IT_GETATTR 0x0008
1578 +#define IT_LOOKUP 0x0010
1579 +#define IT_UNLINK 0x0020
1580 +#define IT_GETXATTR 0x0040
1581 +#define IT_EXEC 0x0080
1582 +#define IT_PIN 0x0100
1583 +#define IT_CHDIR 0x0200
1585 +#define IT_FL_LOCKED 0x0001
1586 +#define IT_FL_FOLLOWED 0x0002 /* set by vfs_follow_link */
1588 +#define INTENT_MAGIC 0x19620323
1591 +struct lustre_intent_data {
1592 + int it_disposition;
1594 + __u64 it_lock_handle;
1599 +struct lookup_intent {
1601 + void (*it_op_release)(struct lookup_intent *);
1604 + int it_create_mode;
1606 + struct lustre_intent_data lustre;
1610 +static inline void intent_init(struct lookup_intent *it, int op, int flags)
1612 + memset(it, 0, sizeof(*it));
1613 + it->it_magic = INTENT_MAGIC;
1615 + it->it_flags = flags;
1620 * linux/include/linux/dcache.h
1622 unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */
1627 struct dentry_operations {
1628 int (*d_revalidate)(struct dentry *, int);
1629 int (*d_hash) (struct dentry *, struct qstr *);
1631 int (*d_delete)(struct dentry *);
1632 void (*d_release)(struct dentry *);
1633 void (*d_iput)(struct dentry *, struct inode *);
1634 + int (*d_revalidate_it)(struct dentry *, int, struct nameidata *, struct lookup_intent *);
1635 + void (*d_pin)(struct dentry *, struct vfsmount * , int);
1636 + void (*d_unpin)(struct dentry *, struct vfsmount *, int);
1639 +#define PIN(de,mnt,flag) if (de && de->d_op && de->d_op->d_pin) \
1640 + de->d_op->d_pin(de, mnt, flag);
1641 +#define UNPIN(de,mnt,flag) if (de && de->d_op && de->d_op->d_unpin) \
1642 + de->d_op->d_unpin(de, mnt, flag);
1645 +/* defined in fs/namei.c */
1646 +extern void intent_release(struct lookup_intent *it);
1647 +/* defined in fs/dcache.c */
1648 +extern void __d_rehash(struct dentry * entry, int lock);
1650 /* the dentry parameter passed to d_hash and d_compare is the parent
1651 * directory of the entries to be compared. It is used in case these
1652 * functions need any directory specific information for determining
1654 * s_nfsd_free_path semaphore will be down
1656 #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
1657 +#define DCACHE_LUSTRE_INVALID 0x0010 /* Lustre invalidated */
1659 extern spinlock_t dcache_lock;
1661 Index: linux-2.4.19.SuSE/include/linux/fs.h
1662 ===================================================================
1663 --- linux-2.4.19.SuSE.orig/include/linux/fs.h Sat Nov 15 17:25:06 2003
1664 +++ linux-2.4.19.SuSE/include/linux/fs.h Sat Nov 15 17:29:03 2003
1667 #define FMODE_READ 1
1668 #define FMODE_WRITE 2
1669 +#define FMODE_EXEC 4
1674 #define ATTR_MTIME_SET 256
1675 #define ATTR_FORCE 512 /* Not a change, but a change it */
1676 #define ATTR_ATTR_FLAG 1024
1677 +#define ATTR_RAW 0x0800 /* file system, not vfs will massage attrs */
1678 +#define ATTR_FROM_OPEN 0x1000 /* called from open path, ie O_TRUNC */
1679 +#define ATTR_CTIME_SET 0x2000
1682 * This is the Inode Attributes structure, used for notify_change(). It
1684 struct pipe_inode_info *i_pipe;
1685 struct block_device *i_bdev;
1686 struct char_device *i_cdev;
1687 + void *i_filterdata;
1689 unsigned long i_dnotify_mask; /* Directory notify events */
1690 struct dnotify_struct *i_dnotify; /* for directory notifications */
1693 /* needed for tty driver, and maybe others */
1695 + struct lookup_intent *f_it;
1697 /* preallocated helper kiobuf to speedup O_DIRECT */
1698 struct kiobuf *f_iobuf;
1703 + struct lookup_intent *intent;
1706 #define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */
1708 extern int __vfs_rmdir(struct inode *, struct dentry *);
1709 extern int vfs_rmdir(struct inode *, struct dentry *);
1710 extern int vfs_unlink(struct inode *, struct dentry *);
1711 -extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
1712 +int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1713 + struct inode *new_dir, struct dentry *new_dentry);
1717 @@ -1020,21 +1028,32 @@
1719 struct inode_operations {
1720 int (*create) (struct inode *,struct dentry *,int);
1721 + int (*create_it) (struct inode *,struct dentry *,int, struct lookup_intent *);
1722 struct dentry * (*lookup) (struct inode *,struct dentry *);
1723 + struct dentry * (*lookup_it) (struct inode *,struct dentry *, struct nameidata *, struct lookup_intent *, int flags);
1724 int (*link) (struct dentry *,struct inode *,struct dentry *);
1725 + int (*link_raw) (struct nameidata *,struct nameidata *);
1726 int (*unlink) (struct inode *,struct dentry *);
1727 + int (*unlink_raw) (struct nameidata *);
1728 int (*symlink) (struct inode *,struct dentry *,const char *);
1729 + int (*symlink_raw) (struct nameidata *,const char *);
1730 int (*mkdir) (struct inode *,struct dentry *,int);
1731 + int (*mkdir_raw) (struct nameidata *,int);
1732 int (*rmdir) (struct inode *,struct dentry *);
1733 + int (*rmdir_raw) (struct nameidata *);
1734 int (*mknod) (struct inode *,struct dentry *,int,int);
1735 + int (*mknod_raw) (struct nameidata *,int,dev_t);
1736 int (*rename) (struct inode *, struct dentry *,
1737 struct inode *, struct dentry *);
1738 + int (*rename_raw) (struct nameidata *, struct nameidata *);
1739 int (*readlink) (struct dentry *, char *,int);
1740 int (*follow_link) (struct dentry *, struct nameidata *);
1741 void (*truncate) (struct inode *);
1742 int (*permission) (struct inode *, int);
1743 int (*revalidate) (struct dentry *);
1744 + int (*revalidate_it) (struct dentry *, struct lookup_intent *);
1745 int (*setattr) (struct dentry *, struct iattr *);
1746 + int (*setattr_raw) (struct inode *, struct iattr *);
1747 int (*getattr) (struct dentry *, struct iattr *);
1748 int (*setxattr) (struct dentry *, const char *, const void *, size_t, int);
1749 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
1751 int (*remount_fs) (struct super_block *, int *, char *);
1752 void (*clear_inode) (struct inode *);
1753 void (*umount_begin) (struct super_block *);
1754 + void (*umount_lustre) (struct super_block *);
1756 /* Following are for knfsd to interact with "interesting" filesystems
1757 * Currently just reiserfs, but possibly FAT and others later
1758 @@ -1244,10 +1263,16 @@
1760 asmlinkage long sys_open(const char *, int, int);
1761 asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
1762 -extern int do_truncate(struct dentry *, loff_t start);
1763 +extern int do_truncate(struct dentry *, loff_t start, int called_from_open);
1764 +struct dentry *lookup_create(struct nameidata *nd, int is_dir,
1765 + struct lookup_intent *it);
1767 extern struct file *filp_open(const char *, int, int);
1768 extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
1769 +extern int open_namei_it(const char *filename, int namei_flags, int mode,
1770 + struct nameidata *nd, struct lookup_intent *it);
1771 +extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1772 + int flags, struct lookup_intent *it);
1773 extern int filp_close(struct file *, fl_owner_t id);
1774 extern char * getname(const char *);
1776 @@ -1515,6 +1538,7 @@
1777 extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
1779 extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
1780 +extern int FASTCALL(__user_walk_it(const char *, unsigned, struct nameidata *, struct lookup_intent *it));
1781 extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
1782 extern int FASTCALL(path_walk(const char *, struct nameidata *));
1783 extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
1784 @@ -1526,6 +1550,8 @@
1785 extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
1786 #define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
1787 #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
1788 +#define user_path_walk_it(name,nd,it) __user_walk_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd, it)
1789 +#define user_path_walk_link_it(name,nd,it) __user_walk_it(name, LOOKUP_POSITIVE, nd, it)
1791 extern void iput(struct inode *);
1792 extern void force_delete(struct inode *);
1793 @@ -1646,6 +1672,8 @@
1795 extern int vfs_readlink(struct dentry *, char *, int, const char *);
1796 extern int vfs_follow_link(struct nameidata *, const char *);
1797 +extern int vfs_follow_link_it(struct nameidata *, const char *,
1798 + struct lookup_intent *it);
1799 extern int page_readlink(struct dentry *, char *, int);
1800 extern int page_follow_link(struct dentry *, struct nameidata *);
1801 extern struct inode_operations page_symlink_inode_operations;
1802 Index: linux-2.4.19.SuSE/include/linux/fs_struct.h
1803 ===================================================================
1804 --- linux-2.4.19.SuSE.orig/include/linux/fs_struct.h Fri Jul 13 15:10:44 2001
1805 +++ linux-2.4.19.SuSE/include/linux/fs_struct.h Sat Nov 15 17:29:03 2003
1807 write_lock(&fs->lock);
1808 old_root = fs->root;
1809 old_rootmnt = fs->rootmnt;
1810 + PIN(dentry, mnt, 1);
1811 fs->rootmnt = mntget(mnt);
1812 fs->root = dget(dentry);
1813 write_unlock(&fs->lock);
1815 + UNPIN(old_root, old_rootmnt, 1);
1817 mntput(old_rootmnt);
1820 write_lock(&fs->lock);
1822 old_pwdmnt = fs->pwdmnt;
1823 + PIN(dentry, mnt, 0);
1824 fs->pwdmnt = mntget(mnt);
1825 fs->pwd = dget(dentry);
1826 write_unlock(&fs->lock);
1828 + UNPIN(old_pwd, old_pwdmnt, 0);
1832 Index: linux-2.4.19.SuSE/kernel/exit.c
1833 ===================================================================
1834 --- linux-2.4.19.SuSE.orig/kernel/exit.c Mon Jan 27 05:08:16 2003
1835 +++ linux-2.4.19.SuSE/kernel/exit.c Sat Nov 15 17:29:03 2003
1836 @@ -288,11 +288,14 @@
1838 /* No need to hold fs->lock if we are killing it */
1839 if (atomic_dec_and_test(&fs->count)) {
1840 + UNPIN(fs->pwd, fs->pwdmnt, 0);
1841 + UNPIN(fs->root, fs->rootmnt, 1);
1843 mntput(fs->rootmnt);
1847 + UNPIN(fs->altroot, fs->altrootmnt, 1);
1849 mntput(fs->altrootmnt);
1851 Index: linux-2.4.19.SuSE/kernel/fork.c
1852 ===================================================================
1853 --- linux-2.4.19.SuSE.orig/kernel/fork.c Mon Jan 27 05:08:56 2003
1854 +++ linux-2.4.19.SuSE/kernel/fork.c Sat Nov 15 17:29:03 2003
1855 @@ -454,10 +454,13 @@
1856 fs->umask = old->umask;
1857 read_lock(&old->lock);
1858 fs->rootmnt = mntget(old->rootmnt);
1859 + PIN(old->pwd, old->pwdmnt, 0);
1860 + PIN(old->root, old->rootmnt, 1);
1861 fs->root = dget(old->root);
1862 fs->pwdmnt = mntget(old->pwdmnt);
1863 fs->pwd = dget(old->pwd);
1865 + PIN(old->altroot, old->altrootmnt, 1);
1866 fs->altrootmnt = mntget(old->altrootmnt);
1867 fs->altroot = dget(old->altroot);
1869 Index: linux-2.4.19.SuSE/kernel/ksyms.c
1870 ===================================================================
1871 --- linux-2.4.19.SuSE.orig/kernel/ksyms.c Sat Nov 15 17:24:46 2003
1872 +++ linux-2.4.19.SuSE/kernel/ksyms.c Sat Nov 15 17:29:03 2003
1874 EXPORT_SYMBOL(set_page_dirty);
1875 EXPORT_SYMBOL(vfs_readlink);
1876 EXPORT_SYMBOL(vfs_follow_link);
1877 +EXPORT_SYMBOL(vfs_follow_link_it);
1878 +EXPORT_SYMBOL(do_umount);
1879 +EXPORT_SYMBOL(lookup_create);
1880 EXPORT_SYMBOL(page_readlink);
1881 EXPORT_SYMBOL(page_follow_link);
1882 EXPORT_SYMBOL(page_symlink_inode_operations);
1883 ===== include/linux/mount.h 1.7 vs edited =====
1884 --- linux-2.4.19.SuSE.orig/include/linux/mount.h Tue Feb 5 09:49:35 2002
1885 +++ linux-2.4.19.SuSE/include/linux/mount.h Tue May 4 19:23:48 2004
1888 char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
1889 struct list_head mnt_list;
1890 + struct list_head mnt_lustre_list; /* GNS mount list */
1891 + unsigned long mnt_last_used; /* for GNS auto-umount (jiffies) */
1894 static inline struct vfsmount *mntget(struct vfsmount *mnt)
1898 extern void __mntput(struct vfsmount *mnt);
1899 +extern int do_umount(struct vfsmount *mnt, int flags);
1901 static inline void mntput(struct vfsmount *mnt)