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, 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, 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, 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, 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, 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 +static 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++;
882 @@ -491,15 +493,18 @@
884 struct nameidata old_nd;
885 struct vfsmount *mnt = NULL;
886 + struct lookup_intent it = { .it_op = IT_GETATTR };
887 int err = mount_is_safe(nd);
890 if (!old_name || !*old_name)
892 if (path_init(old_name, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &old_nd))
893 - err = path_walk(old_name, &old_nd);
895 + err = path_walk_it(old_name, &old_nd, &it);
897 + intent_release(&it);
901 down_write(¤t->namespace->sem);
906 up_write(¤t->namespace->sem);
907 + intent_release(&it);
908 path_release(&old_nd);
912 unsigned long flags, void *data_page)
915 + struct lookup_intent it = { .it_op = IT_GETATTR };
921 /* ... and get the mountpoint */
922 if (path_init(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd))
923 - retval = path_walk(dir_name, &nd);
925 + retval = path_walk_it(dir_name, &nd, &it);
927 + intent_release(&it);
931 if (flags & MS_REMOUNT)
932 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
935 retval = do_add_mount(&nd, type_page, flags, mnt_flags,
936 dev_name, data_page);
938 + intent_release(&it);
944 struct vfsmount *tmp;
945 struct nameidata new_nd, old_nd, parent_nd, root_parent, user_nd;
946 + struct lookup_intent new_it = { .it_op = IT_GETATTR };
947 + struct lookup_intent old_it = { .it_op = IT_GETATTR };
954 if (path_init(name, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &new_nd))
955 - error = path_walk(name, &new_nd);
956 + error = path_walk_it(name, &new_nd, &new_it);
963 if (path_init(name, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &old_nd))
964 - error = path_walk(name, &old_nd);
965 + error = path_walk_it(name, &old_nd, &old_it);
969 @@ -1013,8 +1026,10 @@
970 up(&old_nd.dentry->d_inode->i_zombie);
971 up_write(¤t->namespace->sem);
972 path_release(&user_nd);
973 + intent_release(&old_it);
974 path_release(&old_nd);
976 + intent_release(&new_it);
977 path_release(&new_nd);
980 Index: linux-2.4.19.SuSE/fs/open.c
981 ===================================================================
982 --- linux-2.4.19.SuSE.orig/fs/open.c Mon Jan 27 05:08:00 2003
983 +++ linux-2.4.19.SuSE/fs/open.c Sat Nov 15 17:43:27 2003
985 #include <asm/uaccess.h>
987 #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
988 +extern int path_walk_it(const char *name, struct nameidata *nd,
989 + struct lookup_intent *it);
991 int vfs_statfs(struct super_block *sb, struct statfs *buf)
994 write_unlock(&files->file_lock);
997 -int do_truncate(struct dentry *dentry, loff_t length)
998 +int do_truncate(struct dentry *dentry, loff_t length, int called_from_open)
1000 struct inode *inode = dentry->d_inode;
1001 + struct inode_operations *op = dentry->d_inode->i_op;
1003 struct iattr newattrs;
1005 @@ -108,7 +111,13 @@
1006 down(&inode->i_sem);
1007 newattrs.ia_size = length;
1008 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
1009 - error = notify_change(dentry, &newattrs);
1010 + if (called_from_open)
1011 + newattrs.ia_valid |= ATTR_FROM_OPEN;
1012 + if (op->setattr_raw) {
1013 + newattrs.ia_valid |= ATTR_RAW;
1014 + error = op->setattr_raw(inode, &newattrs);
1016 + error = notify_change(dentry, &newattrs);
1020 @@ -118,12 +127,13 @@
1021 struct nameidata nd;
1022 struct inode * inode;
1024 + struct lookup_intent it = { .it_op = IT_GETATTR };
1027 if (length < 0) /* sorry, but loff_t says... */
1030 - error = user_path_walk(path, &nd);
1031 + error = user_path_walk_it(path, &nd, &it);
1034 inode = nd.dentry->d_inode;
1035 @@ -163,11 +173,13 @@
1036 error = locks_verify_truncate(inode, NULL, length);
1039 - error = do_truncate(nd.dentry, length);
1040 + intent_release(&it);
1041 + error = do_truncate(nd.dentry, length, 0);
1043 put_write_access(inode);
1046 + intent_release(&it);
1052 error = locks_verify_truncate(inode, file, length);
1054 - error = do_truncate(dentry, length);
1055 + error = do_truncate(dentry, length, 0);
1059 @@ -260,11 +272,13 @@
1060 struct inode * inode;
1061 struct iattr newattrs;
1063 - error = user_path_walk(filename, &nd);
1064 + error = user_path_walk_it(filename, &nd, NULL);
1067 inode = nd.dentry->d_inode;
1069 + /* this is safe without a Lustre lock because it only depends
1070 + on the super block */
1072 if (IS_RDONLY(inode))
1074 @@ -279,11 +293,25 @@
1077 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
1081 + if (inode->i_op->setattr_raw) {
1082 + struct inode_operations *op = nd.dentry->d_inode->i_op;
1084 + newattrs.ia_valid |= ATTR_RAW;
1085 + error = op->setattr_raw(inode, &newattrs);
1086 + /* the file system wants to use normal vfs path now */
1087 + if (error != -EOPNOTSUPP)
1088 + goto dput_and_out;
1093 if (current->fsuid != inode->i_uid &&
1094 (error = permission(inode,MAY_WRITE)) != 0)
1098 error = notify_change(nd.dentry, &newattrs);
1101 @@ -304,12 +332,14 @@
1102 struct inode * inode;
1103 struct iattr newattrs;
1105 - error = user_path_walk(filename, &nd);
1106 + error = user_path_walk_it(filename, &nd, NULL);
1110 inode = nd.dentry->d_inode;
1112 + /* this is safe without a Lustre lock because it only depends
1113 + on the super block */
1115 if (IS_RDONLY(inode))
1117 @@ -324,7 +354,20 @@
1118 newattrs.ia_atime = times[0].tv_sec;
1119 newattrs.ia_mtime = times[1].tv_sec;
1120 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
1124 + if (inode->i_op->setattr_raw) {
1125 + struct inode_operations *op = nd.dentry->d_inode->i_op;
1127 + newattrs.ia_valid |= ATTR_RAW;
1128 + error = op->setattr_raw(inode, &newattrs);
1129 + /* the file system wants to use normal vfs path now */
1130 + if (error != -EOPNOTSUPP)
1131 + goto dput_and_out;
1136 if (current->fsuid != inode->i_uid &&
1137 (error = permission(inode,MAY_WRITE)) != 0)
1140 int old_fsuid, old_fsgid;
1141 kernel_cap_t old_cap;
1143 + struct lookup_intent it = { .it_op = IT_GETATTR };
1145 if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
1147 @@ -364,13 +408,14 @@
1149 current->cap_effective = current->cap_permitted;
1151 - res = user_path_walk(filename, &nd);
1152 + res = user_path_walk_it(filename, &nd, &it);
1154 res = permission(nd.dentry->d_inode, mode);
1155 /* SuS v2 requires we report a read only fs too */
1156 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
1157 && !special_file(nd.dentry->d_inode->i_mode))
1159 + intent_release(&it);
1165 struct nameidata nd;
1167 + struct lookup_intent it = { .it_op = IT_GETATTR };
1169 name = getname(filename);
1170 error = PTR_ERR(name);
1174 if (path_init(name,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd))
1175 - error = path_walk(name, &nd);
1176 + error = path_walk_it(name, &nd, &it);
1181 set_fs_pwd(current->fs, nd.mnt, nd.dentry);
1184 + intent_release(&it);
1190 struct nameidata nd;
1192 + struct lookup_intent it = { .it_op = IT_GETATTR };
1194 name = getname(filename);
1195 error = PTR_ERR(name);
1198 path_init(name, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
1199 LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
1200 - error = path_walk(name, &nd);
1201 + error = path_walk_it(name, &nd, &it);
1205 @@ -471,39 +519,56 @@
1209 + intent_release(&it);
1215 -asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
1216 +int chmod_common(struct dentry *dentry, mode_t mode)
1218 - struct inode * inode;
1219 - struct dentry * dentry;
1220 - struct file * file;
1222 + struct inode *inode = dentry->d_inode;
1223 struct iattr newattrs;
1228 + if (IS_RDONLY(inode))
1231 - dentry = file->f_dentry;
1232 - inode = dentry->d_inode;
1233 + if (inode->i_op->setattr_raw) {
1234 + newattrs.ia_mode = mode;
1235 + newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1236 + newattrs.ia_valid |= ATTR_RAW;
1237 + err = inode->i_op->setattr_raw(inode, &newattrs);
1238 + /* the file system wants to use normal vfs path now */
1239 + if (err != -EOPNOTSUPP)
1244 - if (IS_RDONLY(inode))
1247 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1251 if (mode == (mode_t) -1)
1252 mode = inode->i_mode;
1253 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
1254 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1255 err = notify_change(dentry, &newattrs);
1262 +asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
1264 + struct file * file;
1271 + err = chmod_common(file->f_dentry, mode);
1276 @@ -512,30 +577,14 @@
1277 asmlinkage long sys_chmod(const char * filename, mode_t mode)
1279 struct nameidata nd;
1280 - struct inode * inode;
1282 - struct iattr newattrs;
1284 error = user_path_walk(filename, &nd);
1287 - inode = nd.dentry->d_inode;
1290 - if (IS_RDONLY(inode))
1291 - goto dput_and_out;
1294 - if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1295 - goto dput_and_out;
1296 + error = chmod_common(nd.dentry, mode);
1298 - if (mode == (mode_t) -1)
1299 - mode = inode->i_mode;
1300 - newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
1301 - newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1302 - error = notify_change(nd.dentry, &newattrs);
1308 @@ -555,6 +604,20 @@
1310 if (IS_RDONLY(inode))
1313 + if (inode->i_op->setattr_raw) {
1314 + struct inode_operations *op = dentry->d_inode->i_op;
1316 + newattrs.ia_uid = user;
1317 + newattrs.ia_gid = group;
1318 + newattrs.ia_valid = ATTR_UID | ATTR_GID | ATTR_CTIME;
1319 + newattrs.ia_valid |= ATTR_RAW;
1320 + error = op->setattr_raw(inode, &newattrs);
1321 + /* the file system wants to use normal vfs path now */
1322 + if (error != -EOPNOTSUPP)
1327 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1331 int namei_flags, error;
1332 struct nameidata nd;
1333 + struct lookup_intent it = { .it_op = IT_OPEN };
1335 namei_flags = flags;
1336 if ((namei_flags+1) & O_ACCMODE)
1337 @@ -666,14 +730,15 @@
1338 if (namei_flags & O_TRUNC)
1341 - error = open_namei(filename, namei_flags, mode, &nd);
1343 - return dentry_open(nd.dentry, nd.mnt, flags);
1344 + error = open_namei_it(filename, namei_flags, mode, &nd, &it);
1346 + return ERR_PTR(error);
1348 - return ERR_PTR(error);
1349 + return dentry_open_it(nd.dentry, nd.mnt, flags, &it);
1352 -struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1353 +struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1354 + int flags, struct lookup_intent *it)
1357 struct inode *inode;
1361 if (f->f_op && f->f_op->open) {
1363 error = f->f_op->open(inode,f);
1369 !inode->i_mapping->a_ops->direct_IO))
1372 + intent_release(it);
1376 @@ -736,11 +804,17 @@
1380 + intent_release(it);
1383 return ERR_PTR(error);
1386 +struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1388 + return dentry_open_it(dentry, mnt, flags, NULL);
1392 * Find an empty file descriptor entry, and mark it busy.
1394 Index: linux-2.4.19.SuSE/fs/stat.c
1395 ===================================================================
1396 --- linux-2.4.19.SuSE.orig/fs/stat.c Mon Jan 27 05:08:00 2003
1397 +++ linux-2.4.19.SuSE/fs/stat.c Sat Nov 15 17:29:03 2003
1399 * Revalidate the inode. This is required for proper NFS attribute caching.
1401 static __inline__ int
1402 -do_revalidate(struct dentry *dentry)
1403 +do_revalidate(struct dentry *dentry, struct lookup_intent *it)
1405 struct inode * inode = dentry->d_inode;
1406 - if (inode->i_op && inode->i_op->revalidate)
1407 + if (inode->i_op && inode->i_op->revalidate_it)
1408 + return inode->i_op->revalidate_it(dentry, it);
1409 + else if (inode->i_op && inode->i_op->revalidate)
1410 return inode->i_op->revalidate(dentry);
1413 @@ -141,13 +145,15 @@
1414 asmlinkage long sys_stat(char * filename, struct __old_kernel_stat * statbuf)
1416 struct nameidata nd;
1417 + struct lookup_intent it = { .it_op = IT_GETATTR };
1420 - error = user_path_walk(filename, &nd);
1421 + error = user_path_walk_it(filename, &nd, &it);
1423 - error = do_revalidate(nd.dentry);
1424 + error = do_revalidate(nd.dentry, &it);
1426 error = cp_old_stat(nd.dentry->d_inode, statbuf);
1427 + intent_release(&it);
1431 @@ -157,13 +163,15 @@
1432 asmlinkage long sys_newstat(char * filename, struct stat * statbuf)
1434 struct nameidata nd;
1435 + struct lookup_intent it = { .it_op = IT_GETATTR };
1438 - error = user_path_walk(filename, &nd);
1439 + error = user_path_walk_it(filename, &nd, &it);
1441 - error = do_revalidate(nd.dentry);
1442 + error = do_revalidate(nd.dentry, &it);
1444 error = cp_new_stat(nd.dentry->d_inode, statbuf);
1445 + intent_release(&it);
1449 @@ -178,13 +186,15 @@
1450 asmlinkage long sys_lstat(char * filename, struct __old_kernel_stat * statbuf)
1452 struct nameidata nd;
1453 + struct lookup_intent it = { .it_op = IT_GETATTR };
1456 - error = user_path_walk_link(filename, &nd);
1457 + error = user_path_walk_link_it(filename, &nd, &it);
1459 - error = do_revalidate(nd.dentry);
1460 + error = do_revalidate(nd.dentry, &it);
1462 error = cp_old_stat(nd.dentry->d_inode, statbuf);
1463 + intent_release(&it);
1467 @@ -195,13 +205,15 @@
1468 asmlinkage long sys_newlstat(char * filename, struct stat * statbuf)
1470 struct nameidata nd;
1471 + struct lookup_intent it = { .it_op = IT_GETATTR };
1474 - error = user_path_walk_link(filename, &nd);
1475 + error = user_path_walk_link_it(filename, &nd, &it);
1477 - error = do_revalidate(nd.dentry);
1478 + error = do_revalidate(nd.dentry, &it);
1480 error = cp_new_stat(nd.dentry->d_inode, statbuf);
1481 + intent_release(&it);
1487 struct dentry * dentry = f->f_dentry;
1489 - err = do_revalidate(dentry);
1490 + err = do_revalidate(dentry, NULL);
1492 err = cp_old_stat(dentry->d_inode, statbuf);
1496 struct dentry * dentry = f->f_dentry;
1498 - err = do_revalidate(dentry);
1499 + err = do_revalidate(dentry, NULL);
1501 err = cp_new_stat(dentry->d_inode, statbuf);
1506 if (inode->i_op && inode->i_op->readlink &&
1507 - !(error = do_revalidate(nd.dentry))) {
1508 + !(error = do_revalidate(nd.dentry, NULL))) {
1509 UPDATE_ATIME(inode);
1510 error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
1512 @@ -339,12 +351,14 @@
1514 struct nameidata nd;
1516 + struct lookup_intent it = { .it_op = IT_GETATTR };
1518 - error = user_path_walk(filename, &nd);
1519 + error = user_path_walk_it(filename, &nd, &it);
1521 - error = do_revalidate(nd.dentry);
1522 + error = do_revalidate(nd.dentry, &it);
1524 error = cp_new_stat64(nd.dentry->d_inode, statbuf);
1525 + intent_release(&it);
1529 @@ -354,12 +368,14 @@
1531 struct nameidata nd;
1533 + struct lookup_intent it = { .it_op = IT_GETATTR };
1535 - error = user_path_walk_link(filename, &nd);
1536 + error = user_path_walk_link_it(filename, &nd, &it);
1538 - error = do_revalidate(nd.dentry);
1539 + error = do_revalidate(nd.dentry, &it);
1541 error = cp_new_stat64(nd.dentry->d_inode, statbuf);
1542 + intent_release(&it);
1548 struct dentry * dentry = f->f_dentry;
1550 - err = do_revalidate(dentry);
1551 + err = do_revalidate(dentry, NULL);
1553 err = cp_new_stat64(dentry->d_inode, statbuf);
1555 Index: linux-2.4.19.SuSE/include/linux/dcache.h
1556 ===================================================================
1557 --- linux-2.4.19.SuSE.orig/include/linux/dcache.h Mon Jan 27 05:13:15 2003
1558 +++ linux-2.4.19.SuSE/include/linux/dcache.h Sat Nov 15 17:35:46 2003
1561 #include <asm/atomic.h>
1562 #include <linux/mount.h>
1563 +#include <linux/string.h>
1565 +#define IT_OPEN 0x0001
1566 +#define IT_CREAT 0x0002
1567 +#define IT_READDIR 0x0004
1568 +#define IT_GETATTR 0x0008
1569 +#define IT_LOOKUP 0x0010
1570 +#define IT_UNLINK 0x0020
1571 +#define IT_GETXATTR 0x0040
1572 +#define IT_EXEC 0x0080
1573 +#define IT_PIN 0x0100
1575 +#define IT_FL_LOCKED 0x0001
1576 +#define IT_FL_FOLLOWED 0x0002 /* set by vfs_follow_link */
1578 +#define INTENT_MAGIC 0x19620323
1581 +struct lustre_intent_data {
1582 + int it_disposition;
1584 + __u64 it_lock_handle;
1589 +struct lookup_intent {
1591 + void (*it_op_release)(struct lookup_intent *);
1594 + int it_create_mode;
1596 + struct lustre_intent_data lustre;
1600 +static inline void intent_init(struct lookup_intent *it, int op, int flags)
1602 + memset(it, 0, sizeof(*it));
1603 + it->it_magic = INTENT_MAGIC;
1605 + it->it_flags = flags;
1610 * linux/include/linux/dcache.h
1612 int (*d_delete)(struct dentry *);
1613 void (*d_release)(struct dentry *);
1614 void (*d_iput)(struct dentry *, struct inode *);
1615 + int (*d_revalidate_it)(struct dentry *, int, struct lookup_intent *);
1616 + void (*d_pin)(struct dentry *, struct vfsmount * , int);
1617 + void (*d_unpin)(struct dentry *, struct vfsmount *, int);
1620 +#define PIN(de,mnt,flag) if (de && de->d_op && de->d_op->d_pin) \
1621 + de->d_op->d_pin(de, mnt, flag);
1622 +#define UNPIN(de,mnt,flag) if (de && de->d_op && de->d_op->d_unpin) \
1623 + de->d_op->d_unpin(de, mnt, flag);
1626 +/* defined in fs/namei.c */
1627 +extern void intent_release(struct lookup_intent *it);
1628 +/* defined in fs/dcache.c */
1629 +extern void __d_rehash(struct dentry * entry, int lock);
1631 /* the dentry parameter passed to d_hash and d_compare is the parent
1632 * directory of the entries to be compared. It is used in case these
1633 * functions need any directory specific information for determining
1635 * s_nfsd_free_path semaphore will be down
1637 #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
1638 +#define DCACHE_LUSTRE_INVALID 0x0010 /* Lustre invalidated */
1640 extern spinlock_t dcache_lock;
1642 Index: linux-2.4.19.SuSE/include/linux/fs.h
1643 ===================================================================
1644 --- linux-2.4.19.SuSE.orig/include/linux/fs.h Sat Nov 15 17:25:06 2003
1645 +++ linux-2.4.19.SuSE/include/linux/fs.h Sat Nov 15 17:29:03 2003
1648 #define FMODE_READ 1
1649 #define FMODE_WRITE 2
1650 +#define FMODE_EXEC 4
1655 #define ATTR_MTIME_SET 256
1656 #define ATTR_FORCE 512 /* Not a change, but a change it */
1657 #define ATTR_ATTR_FLAG 1024
1658 +#define ATTR_RAW 0x0800 /* file system, not vfs will massage attrs */
1659 +#define ATTR_FROM_OPEN 0x1000 /* called from open path, ie O_TRUNC */
1660 +#define ATTR_CTIME_SET 0x2000
1663 * This is the Inode Attributes structure, used for notify_change(). It
1665 struct pipe_inode_info *i_pipe;
1666 struct block_device *i_bdev;
1667 struct char_device *i_cdev;
1668 + void *i_filterdata;
1670 unsigned long i_dnotify_mask; /* Directory notify events */
1671 struct dnotify_struct *i_dnotify; /* for directory notifications */
1674 /* needed for tty driver, and maybe others */
1676 + struct lookup_intent *f_it;
1678 /* preallocated helper kiobuf to speedup O_DIRECT */
1679 struct kiobuf *f_iobuf;
1684 + struct lookup_intent *intent;
1687 #define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */
1689 extern int __vfs_rmdir(struct inode *, struct dentry *);
1690 extern int vfs_rmdir(struct inode *, struct dentry *);
1691 extern int vfs_unlink(struct inode *, struct dentry *);
1692 -extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
1693 +int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1694 + struct inode *new_dir, struct dentry *new_dentry);
1698 @@ -1020,21 +1028,32 @@
1700 struct inode_operations {
1701 int (*create) (struct inode *,struct dentry *,int);
1702 + int (*create_it) (struct inode *,struct dentry *,int, struct lookup_intent *);
1703 struct dentry * (*lookup) (struct inode *,struct dentry *);
1704 + struct dentry * (*lookup_it) (struct inode *,struct dentry *, struct lookup_intent *, int flags);
1705 int (*link) (struct dentry *,struct inode *,struct dentry *);
1706 + int (*link_raw) (struct nameidata *,struct nameidata *);
1707 int (*unlink) (struct inode *,struct dentry *);
1708 + int (*unlink_raw) (struct nameidata *);
1709 int (*symlink) (struct inode *,struct dentry *,const char *);
1710 + int (*symlink_raw) (struct nameidata *,const char *);
1711 int (*mkdir) (struct inode *,struct dentry *,int);
1712 + int (*mkdir_raw) (struct nameidata *,int);
1713 int (*rmdir) (struct inode *,struct dentry *);
1714 + int (*rmdir_raw) (struct nameidata *);
1715 int (*mknod) (struct inode *,struct dentry *,int,int);
1716 + int (*mknod_raw) (struct nameidata *,int,dev_t);
1717 int (*rename) (struct inode *, struct dentry *,
1718 struct inode *, struct dentry *);
1719 + int (*rename_raw) (struct nameidata *, struct nameidata *);
1720 int (*readlink) (struct dentry *, char *,int);
1721 int (*follow_link) (struct dentry *, struct nameidata *);
1722 void (*truncate) (struct inode *);
1723 int (*permission) (struct inode *, int);
1724 int (*revalidate) (struct dentry *);
1725 + int (*revalidate_it) (struct dentry *, struct lookup_intent *);
1726 int (*setattr) (struct dentry *, struct iattr *);
1727 + int (*setattr_raw) (struct inode *, struct iattr *);
1728 int (*getattr) (struct dentry *, struct iattr *);
1729 int (*setxattr) (struct dentry *, const char *, const void *, size_t, int);
1730 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
1731 @@ -1244,10 +1263,14 @@
1733 asmlinkage long sys_open(const char *, int, int);
1734 asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
1735 -extern int do_truncate(struct dentry *, loff_t start);
1736 +extern int do_truncate(struct dentry *, loff_t start, int called_from_open);
1738 extern struct file *filp_open(const char *, int, int);
1739 extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
1740 +extern int open_namei_it(const char *filename, int namei_flags, int mode,
1741 + struct nameidata *nd, struct lookup_intent *it);
1742 +extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1743 + int flags, struct lookup_intent *it);
1744 extern int filp_close(struct file *, fl_owner_t id);
1745 extern char * getname(const char *);
1747 @@ -1515,6 +1538,7 @@
1748 extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
1750 extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
1751 +extern int FASTCALL(__user_walk_it(const char *, unsigned, struct nameidata *, struct lookup_intent *it));
1752 extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
1753 extern int FASTCALL(path_walk(const char *, struct nameidata *));
1754 extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
1755 @@ -1526,6 +1550,8 @@
1756 extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
1757 #define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
1758 #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
1759 +#define user_path_walk_it(name,nd,it) __user_walk_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd, it)
1760 +#define user_path_walk_link_it(name,nd,it) __user_walk_it(name, LOOKUP_POSITIVE, nd, it)
1762 extern void iput(struct inode *);
1763 extern void force_delete(struct inode *);
1764 @@ -1646,6 +1672,8 @@
1766 extern int vfs_readlink(struct dentry *, char *, int, const char *);
1767 extern int vfs_follow_link(struct nameidata *, const char *);
1768 +extern int vfs_follow_link_it(struct nameidata *, const char *,
1769 + struct lookup_intent *it);
1770 extern int page_readlink(struct dentry *, char *, int);
1771 extern int page_follow_link(struct dentry *, struct nameidata *);
1772 extern struct inode_operations page_symlink_inode_operations;
1773 Index: linux-2.4.19.SuSE/include/linux/fs_struct.h
1774 ===================================================================
1775 --- linux-2.4.19.SuSE.orig/include/linux/fs_struct.h Fri Jul 13 15:10:44 2001
1776 +++ linux-2.4.19.SuSE/include/linux/fs_struct.h Sat Nov 15 17:29:03 2003
1778 write_lock(&fs->lock);
1779 old_root = fs->root;
1780 old_rootmnt = fs->rootmnt;
1781 + PIN(dentry, mnt, 1);
1782 fs->rootmnt = mntget(mnt);
1783 fs->root = dget(dentry);
1784 write_unlock(&fs->lock);
1786 + UNPIN(old_root, old_rootmnt, 1);
1788 mntput(old_rootmnt);
1791 write_lock(&fs->lock);
1793 old_pwdmnt = fs->pwdmnt;
1794 + PIN(dentry, mnt, 0);
1795 fs->pwdmnt = mntget(mnt);
1796 fs->pwd = dget(dentry);
1797 write_unlock(&fs->lock);
1799 + UNPIN(old_pwd, old_pwdmnt, 0);
1803 Index: linux-2.4.19.SuSE/kernel/exit.c
1804 ===================================================================
1805 --- linux-2.4.19.SuSE.orig/kernel/exit.c Mon Jan 27 05:08:16 2003
1806 +++ linux-2.4.19.SuSE/kernel/exit.c Sat Nov 15 17:29:03 2003
1807 @@ -288,11 +288,14 @@
1809 /* No need to hold fs->lock if we are killing it */
1810 if (atomic_dec_and_test(&fs->count)) {
1811 + UNPIN(fs->pwd, fs->pwdmnt, 0);
1812 + UNPIN(fs->root, fs->rootmnt, 1);
1814 mntput(fs->rootmnt);
1818 + UNPIN(fs->altroot, fs->altrootmnt, 1);
1820 mntput(fs->altrootmnt);
1822 Index: linux-2.4.19.SuSE/kernel/fork.c
1823 ===================================================================
1824 --- linux-2.4.19.SuSE.orig/kernel/fork.c Mon Jan 27 05:08:56 2003
1825 +++ linux-2.4.19.SuSE/kernel/fork.c Sat Nov 15 17:29:03 2003
1826 @@ -454,10 +454,13 @@
1827 fs->umask = old->umask;
1828 read_lock(&old->lock);
1829 fs->rootmnt = mntget(old->rootmnt);
1830 + PIN(old->pwd, old->pwdmnt, 0);
1831 + PIN(old->root, old->rootmnt, 1);
1832 fs->root = dget(old->root);
1833 fs->pwdmnt = mntget(old->pwdmnt);
1834 fs->pwd = dget(old->pwd);
1836 + PIN(old->altroot, old->altrootmnt, 1);
1837 fs->altrootmnt = mntget(old->altrootmnt);
1838 fs->altroot = dget(old->altroot);
1840 Index: linux-2.4.19.SuSE/kernel/ksyms.c
1841 ===================================================================
1842 --- linux-2.4.19.SuSE.orig/kernel/ksyms.c Sat Nov 15 17:24:46 2003
1843 +++ linux-2.4.19.SuSE/kernel/ksyms.c Sat Nov 15 17:29:03 2003
1845 EXPORT_SYMBOL(set_page_dirty);
1846 EXPORT_SYMBOL(vfs_readlink);
1847 EXPORT_SYMBOL(vfs_follow_link);
1848 +EXPORT_SYMBOL(vfs_follow_link_it);
1849 EXPORT_SYMBOL(page_readlink);
1850 EXPORT_SYMBOL(page_follow_link);
1851 EXPORT_SYMBOL(page_symlink_inode_operations);