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.21-suse2/fs/dcache.c
16 ===================================================================
17 --- linux-2.4.21-suse2.orig/fs/dcache.c 2003-10-28 21:33:59.000000000 +0300
18 +++ linux-2.4.21-suse2/fs/dcache.c 2004-01-10 12:15:41.000000000 +0300
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.21-suse2/fs/exec.c
57 ===================================================================
58 --- linux-2.4.21-suse2.orig/fs/exec.c 2003-10-28 21:34:17.000000000 +0300
59 +++ linux-2.4.21-suse2/fs/exec.c 2004-01-10 12:15:41.000000000 +0300
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 - err = path_lookup(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd);
90 + err = path_lookup_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd, &it);
93 inode = nd.dentry->d_inode;
98 - file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
99 + file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it);
100 + intent_release(&it);
102 err = deny_write_access(file);
108 + intent_release(&it);
112 @@ -1150,7 +1157,7 @@
114 if (!file->f_op->write)
116 - if (do_truncate(file->f_dentry, 0) != 0)
117 + if (do_truncate(file->f_dentry, 0, 0) != 0)
120 retval = binfmt->core_dump(signr, regs, file);
121 Index: linux-2.4.21-suse2/fs/namei.c
122 ===================================================================
123 --- linux-2.4.21-suse2.orig/fs/namei.c 2004-01-10 12:06:40.000000000 +0300
124 +++ linux-2.4.21-suse2/fs/namei.c 2004-01-10 12:55:09.000000000 +0300
126 * XEmacs seems to be relying on it...
129 +void intent_release(struct lookup_intent *it)
131 + if (it && it->it_op_release)
132 + it->it_op_release(it);
136 /* In order to reduce some races, while at the same time doing additional
137 * checking and hopefully speeding things up, we copy filenames to the
138 * kernel data space before using them..
139 @@ -260,10 +267,19 @@
140 * Internal lookup() using the new generic dcache.
143 -static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name, int flags)
144 +static struct dentry *cached_lookup(struct dentry *parent, struct qstr *name,
145 + int flags, struct lookup_intent *it)
147 struct dentry * dentry = d_lookup(parent, name);
149 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
150 + if (!dentry->d_op->d_revalidate_it(dentry, flags, it) &&
151 + !d_invalidate(dentry)) {
157 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
158 if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) {
160 @@ -281,11 +297,15 @@
161 * make sure that nobody added the entry to the dcache in the meantime..
164 -static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, int flags)
165 +static struct dentry *real_lookup(struct dentry *parent, struct qstr *name,
166 + int flags, struct lookup_intent *it)
168 struct dentry * result;
169 struct inode *dir = parent->d_inode;
176 * First re-do the cached lookup just in case it was created
178 result = ERR_PTR(-ENOMEM);
181 + if (dir->i_op->lookup_it)
182 + result = dir->i_op->lookup_it(dir, dentry, it, flags);
184 result = dir->i_op->lookup(dir, dentry);
189 result = ERR_PTR(-ENOENT);
191 + } else if (result->d_op && result->d_op->d_revalidate_it) {
192 + if (!result->d_op->d_revalidate_it(result, flags, it) &&
193 + !d_invalidate(result)) {
196 + result = ERR_PTR(-ESTALE);
197 + if (!IS_ERR(result))
204 * Without that kind of total limit, nasty chains of consecutive
205 * symlinks can cause almost arbitrarily long lookups.
207 -static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
208 +static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd,
209 + struct lookup_intent *it)
212 if (current->link_count >= 8)
213 @@ -346,10 +379,12 @@
214 current->link_count++;
215 current->total_link_count++;
216 UPDATE_ATIME(dentry->d_inode);
218 err = dentry->d_inode->i_op->follow_link(dentry, nd);
219 current->link_count--;
222 + intent_release(it);
228 * We expect 'base' to be positive and a directory.
230 -static inline int __link_path_walk(const char * name, struct nameidata *nd)
231 +static inline int __link_path_walk_it(const char * name, struct nameidata *nd,
232 + struct lookup_intent *it)
234 struct dentry *dentry;
236 @@ -524,12 +560,12 @@
239 /* This does the actual lookups.. */
240 - dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
241 + dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE, NULL);
243 err = -EWOULDBLOCKIO;
246 - dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
247 + dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE, NULL);
248 err = PTR_ERR(dentry);
254 if (inode->i_op->follow_link) {
255 - err = do_follow_link(dentry, nd);
256 + err = do_follow_link(dentry, nd, NULL);
264 - if (!inode->i_op->lookup)
265 + if (!inode->i_op->lookup && !inode->i_op->lookup_it)
268 /* here ends the main loop */
269 @@ -590,12 +626,12 @@
273 - dentry = cached_lookup(nd->dentry, &this, 0);
274 + dentry = cached_lookup(nd->dentry, &this, 0, it);
276 err = -EWOULDBLOCKIO;
279 - dentry = real_lookup(nd->dentry, &this, 0);
280 + dentry = real_lookup(nd->dentry, &this, 0, it);
281 err = PTR_ERR(dentry);
285 inode = dentry->d_inode;
286 if ((lookup_flags & LOOKUP_FOLLOW)
287 && inode && inode->i_op && inode->i_op->follow_link) {
288 - err = do_follow_link(dentry, nd);
289 + err = do_follow_link(dentry, nd, it);
295 if (lookup_flags & LOOKUP_DIRECTORY) {
297 - if (!inode->i_op || !inode->i_op->lookup)
298 + if (!inode->i_op ||
299 + (!inode->i_op->lookup && !inode->i_op->lookup_it))
304 * Check the cached dentry for staleness.
307 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
309 + if (!dentry->d_op->d_revalidate_it(dentry, 0, it)) {
310 + struct dentry *new;
311 + err = permission(dentry->d_parent->d_inode,
315 + new = real_lookup(dentry->d_parent,
316 + &dentry->d_name, 0, NULL);
317 + d_invalidate(dentry);
320 + err = PTR_ERR(new);
326 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
328 if (!dentry->d_op->d_revalidate(dentry, lookup_flags & LOOKUP_PARENT)) {
334 + intent_release(it);
338 @@ -663,13 +721,13 @@
340 int link_path_walk(const char * name, struct nameidata *nd)
342 - return __link_path_walk(name,nd);
343 + return __link_path_walk_it(name, nd, NULL);
346 static inline int __path_walk(const char * name, struct nameidata *nd)
348 current->total_link_count = 0;
349 - return __link_path_walk(name, nd);
350 + return __link_path_walk_it(name, nd, NULL);
353 int path_walk(const char * name, struct nameidata *nd)
355 return __path_walk(name, nd);
358 +int path_walk_it(const char * name, struct nameidata *nd, struct lookup_intent *it)
360 + current->total_link_count = 0;
361 + return __link_path_walk_it(name, nd, it);
365 /* returns 1 if everything is done */
366 static int __emul_lookup_dentry(const char *name, struct nameidata *nd)
371 +int path_lookup_it(const char *path, unsigned flags, struct nameidata *nd,
372 + struct lookup_intent *it)
375 + if (path_init(path, flags, nd))
376 + error = path_walk_it(path, nd, it);
382 int path_lookup(const char *path, unsigned flags, struct nameidata *nd)
387 nd->last_type = LAST_ROOT; /* if there are only slashes... */
391 return walk_init_root(name,nd);
392 read_lock(¤t->fs->lock);
394 * needs parent already locked. Doesn't follow mounts.
397 -struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
398 +struct dentry * lookup_hash_it(struct qstr *name, struct dentry * base,
399 + struct lookup_intent *it)
401 struct dentry * dentry;
403 @@ -810,13 +887,16 @@
407 - dentry = cached_lookup(base, name, 0);
408 + dentry = cached_lookup(base, name, 0, it);
410 struct dentry *new = d_alloc(base, name);
411 dentry = ERR_PTR(-ENOMEM);
415 + if (inode->i_op->lookup_it)
416 + dentry = inode->i_op->lookup_it(inode, new, it, 0);
418 dentry = inode->i_op->lookup(inode, new);
425 +struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
427 + return lookup_hash_it(name, base, NULL);
432 struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
436 this.hash = end_name_hash(hash);
438 - return lookup_hash(&this, base);
439 + return lookup_hash_it(&this, base, NULL);
441 return ERR_PTR(-EACCES);
447 +int __user_walk_it(const char *name, unsigned flags, struct nameidata *nd,
448 + struct lookup_intent *it)
453 + tmp = getname(name);
454 + err = PTR_ERR(tmp);
455 + if (!IS_ERR(tmp)) {
457 + if (path_init(tmp, flags, nd))
458 + err = path_walk_it(tmp, nd, it);
465 * It's inline, so penalty for filesystems that don't use sticky bit is
471 -int vfs_create(struct inode *dir, struct dentry *dentry, int mode)
472 +static int vfs_create_it(struct inode *dir, struct dentry *dentry, int mode,
473 + struct lookup_intent *it)
477 @@ -990,12 +1094,15 @@
480 error = -EACCES; /* shouldn't it be ENOSYS? */
481 - if (!dir->i_op || !dir->i_op->create)
482 + if (!dir->i_op || (!dir->i_op->create && !dir->i_op->create_it))
487 - error = dir->i_op->create(dir, dentry, mode);
488 + if (dir->i_op->create_it)
489 + error = dir->i_op->create_it(dir, dentry, mode, it);
491 + error = dir->i_op->create(dir, dentry, mode);
495 @@ -1004,6 +1111,11 @@
499 +int vfs_create(struct inode *dir, struct dentry *dentry, int mode)
501 + return vfs_create_it(dir, dentry, mode, NULL);
507 @@ -1018,7 +1130,8 @@
508 * for symlinks (where the permissions are checked later).
511 -int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
512 +int open_namei_it(const char *pathname, int flag, int mode,
513 + struct nameidata *nd, struct lookup_intent *it)
515 int acc_mode, error = 0;
517 @@ -1028,11 +1141,14 @@
519 acc_mode = ACC_MODE(flag);
522 + it->it_flags = flag;
525 * The simplest case - just a plain lookup.
527 if (!(flag & O_CREAT)) {
528 - error = path_lookup(pathname, lookup_flags(flag), nd);
529 + error = path_lookup_it(pathname, lookup_flags(flag), nd, it);
533 @@ -1042,6 +1158,10 @@
535 * Create - we need to know the parent.
538 + it->it_create_mode = mode;
539 + it->it_op |= IT_CREAT;
541 error = path_lookup(pathname, LOOKUP_PARENT, nd);
544 @@ -1057,7 +1177,7 @@
547 down(&dir->d_inode->i_sem);
548 - dentry = lookup_hash(&nd->last, nd->dentry);
549 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
552 error = PTR_ERR(dentry);
553 @@ -1066,11 +1186,12 @@
557 + it->it_create_mode = mode;
558 /* Negative dentry, just create the file */
559 if (!dentry->d_inode) {
560 if (!IS_POSIXACL(dir->d_inode))
561 mode &= ~current->fs->umask;
562 - error = vfs_create(dir->d_inode, dentry, mode);
563 + error = vfs_create_it(dir->d_inode, dentry, mode, it);
564 up(&dir->d_inode->i_sem);
565 #ifndef DENTRY_WASTE_RAM
567 @@ -1178,7 +1299,7 @@
571 - error = do_truncate(dentry, 0);
572 + error = do_truncate(dentry, 0, 1);
574 put_write_access(inode);
576 @@ -1190,8 +1311,10 @@
580 + intent_release(it);
583 + intent_release(it);
587 @@ -1210,7 +1333,10 @@
588 * are done. Procfs-like symlinks just set LAST_BIND.
590 UPDATE_ATIME(dentry->d_inode);
592 error = dentry->d_inode->i_op->follow_link(dentry, nd);
594 + intent_release(it);
598 @@ -1232,13 +1358,20 @@
601 down(&dir->d_inode->i_sem);
602 - dentry = lookup_hash(&nd->last, nd->dentry);
603 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
604 putname(nd->last.name);
608 +int open_namei(const char *pathname, int flag, int mode, struct nameidata *nd)
610 + return open_namei_it(pathname, flag, mode, nd, NULL);
615 -struct dentry *lookup_create(struct nameidata *nd, int is_dir)
616 +struct dentry *lookup_create(struct nameidata *nd, int is_dir,
617 + struct lookup_intent *it)
619 struct dentry *dentry;
621 @@ -1246,7 +1379,7 @@
622 dentry = ERR_PTR(-EEXIST);
623 if (nd->last_type != LAST_NORM)
625 - dentry = lookup_hash(&nd->last, nd->dentry);
626 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
629 if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
630 @@ -1302,7 +1435,16 @@
631 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
634 - dentry = lookup_create(&nd, 0);
636 + if (nd.dentry->d_inode->i_op->mknod_raw) {
637 + struct inode_operations *op = nd.dentry->d_inode->i_op;
638 + error = op->mknod_raw(&nd, mode, dev);
639 + /* the file system wants to use normal vfs path now */
640 + if (error != -EOPNOTSUPP)
644 + dentry = lookup_create(&nd, 0, NULL);
645 error = PTR_ERR(dentry);
647 if (!IS_POSIXACL(nd.dentry->d_inode))
648 @@ -1324,6 +1466,7 @@
651 up(&nd.dentry->d_inode->i_sem);
656 @@ -1371,7 +1514,14 @@
657 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
660 - dentry = lookup_create(&nd, 1);
661 + if (nd.dentry->d_inode->i_op->mkdir_raw) {
662 + struct inode_operations *op = nd.dentry->d_inode->i_op;
663 + error = op->mkdir_raw(&nd, mode);
664 + /* the file system wants to use normal vfs path now */
665 + if (error != -EOPNOTSUPP)
668 + dentry = lookup_create(&nd, 1, NULL);
669 error = PTR_ERR(dentry);
670 if (!IS_ERR(dentry)) {
671 if (!IS_POSIXACL(nd.dentry->d_inode))
672 @@ -1380,6 +1530,7 @@
675 up(&nd.dentry->d_inode->i_sem);
680 @@ -1480,8 +1631,16 @@
684 + if (nd.dentry->d_inode->i_op->rmdir_raw) {
685 + struct inode_operations *op = nd.dentry->d_inode->i_op;
687 + error = op->rmdir_raw(&nd);
688 + /* the file system wants to use normal vfs path now */
689 + if (error != -EOPNOTSUPP)
692 down(&nd.dentry->d_inode->i_sem);
693 - dentry = lookup_hash(&nd.last, nd.dentry);
694 + dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
695 error = PTR_ERR(dentry);
696 if (!IS_ERR(dentry)) {
697 error = vfs_rmdir(nd.dentry->d_inode, dentry);
698 @@ -1539,8 +1698,15 @@
700 if (nd.last_type != LAST_NORM)
702 + if (nd.dentry->d_inode->i_op->unlink_raw) {
703 + struct inode_operations *op = nd.dentry->d_inode->i_op;
704 + error = op->unlink_raw(&nd);
705 + /* the file system wants to use normal vfs path now */
706 + if (error != -EOPNOTSUPP)
709 down(&nd.dentry->d_inode->i_sem);
710 - dentry = lookup_hash(&nd.last, nd.dentry);
711 + dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
712 error = PTR_ERR(dentry);
713 if (!IS_ERR(dentry)) {
714 /* Why not before? Because we want correct error value */
715 @@ -1607,15 +1773,23 @@
716 error = path_lookup(to, LOOKUP_PARENT, &nd);
719 - dentry = lookup_create(&nd, 0);
720 + if (nd.dentry->d_inode->i_op->symlink_raw) {
721 + struct inode_operations *op = nd.dentry->d_inode->i_op;
722 + error = op->symlink_raw(&nd, from);
723 + /* the file system wants to use normal vfs path now */
724 + if (error != -EOPNOTSUPP)
727 + dentry = lookup_create(&nd, 0, NULL);
728 error = PTR_ERR(dentry);
729 if (!IS_ERR(dentry)) {
730 error = vfs_symlink(nd.dentry->d_inode, dentry, from);
733 up(&nd.dentry->d_inode->i_sem);
741 @@ -1691,7 +1865,14 @@
743 if (old_nd.mnt != nd.mnt)
745 - new_dentry = lookup_create(&nd, 0);
746 + if (nd.dentry->d_inode->i_op->link_raw) {
747 + struct inode_operations *op = nd.dentry->d_inode->i_op;
748 + error = op->link_raw(&old_nd, &nd);
749 + /* the file system wants to use normal vfs path now */
750 + if (error != -EOPNOTSUPP)
753 + new_dentry = lookup_create(&nd, 0, NULL);
754 error = PTR_ERR(new_dentry);
755 if (!IS_ERR(new_dentry)) {
756 error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
757 @@ -1735,7 +1916,7 @@
760 int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
761 - struct inode *new_dir, struct dentry *new_dentry)
762 + struct inode *new_dir, struct dentry *new_dentry)
765 struct inode *target;
766 @@ -1814,7 +1995,7 @@
769 int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
770 - struct inode *new_dir, struct dentry *new_dentry)
771 + struct inode *new_dir, struct dentry *new_dentry)
775 @@ -1902,9 +2083,18 @@
776 if (newnd.last_type != LAST_NORM)
779 + if (old_dir->d_inode->i_op->rename_raw) {
781 + error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
783 + /* the file system wants to use normal vfs path now */
784 + if (error != -EOPNOTSUPP)
788 double_lock(new_dir, old_dir);
790 - old_dentry = lookup_hash(&oldnd.last, old_dir);
791 + old_dentry = lookup_hash_it(&oldnd.last, old_dir, NULL);
792 error = PTR_ERR(old_dentry);
793 if (IS_ERR(old_dentry))
795 @@ -1920,16 +2110,16 @@
796 if (newnd.last.name[newnd.last.len])
799 - new_dentry = lookup_hash(&newnd.last, new_dir);
800 + new_dentry = lookup_hash_it(&newnd.last, new_dir, NULL);
801 error = PTR_ERR(new_dentry);
802 if (IS_ERR(new_dentry))
807 error = vfs_rename(old_dir->d_inode, old_dentry,
808 new_dir->d_inode, new_dentry);
814 @@ -1980,20 +2170,26 @@
818 -__vfs_follow_link(struct nameidata *nd, const char *link)
819 +__vfs_follow_link(struct nameidata *nd, const char *link,
820 + struct lookup_intent *it)
829 + else if (it != nd->intent)
830 + printk("it != nd->intent: tell phil@clusterfs.com\n");
834 if (!walk_init_root(link, nd))
835 /* weird __emul_prefix() stuff did it */
838 - res = __link_path_walk(link, nd);
839 + res = __link_path_walk_it(link, nd, it);
841 if (current->link_count || res || nd->last_type!=LAST_NORM)
843 @@ -2017,7 +2213,13 @@
845 int vfs_follow_link(struct nameidata *nd, const char *link)
847 - return __vfs_follow_link(nd, link);
848 + return __vfs_follow_link(nd, link, NULL);
851 +int vfs_follow_link_it(struct nameidata *nd, const char *link,
852 + struct lookup_intent *it)
854 + return __vfs_follow_link(nd, link, it);
857 /* get the link contents into pagecache */
858 @@ -2059,7 +2261,7 @@
860 struct page *page = NULL;
861 char *s = page_getlink(dentry, &page);
862 - int res = __vfs_follow_link(nd, s);
863 + int res = __vfs_follow_link(nd, s, NULL);
866 page_cache_release(page);
867 Index: linux-2.4.21-suse2/fs/namespace.c
868 ===================================================================
869 --- linux-2.4.21-suse2.orig/fs/namespace.c 2003-10-28 21:34:12.000000000 +0300
870 +++ linux-2.4.21-suse2/fs/namespace.c 2004-01-10 12:15:41.000000000 +0300
873 old_nd->dentry = mnt->mnt_mountpoint;
874 old_nd->mnt = mnt->mnt_parent;
875 + UNPIN(old_nd->dentry, old_nd->mnt, 1);
876 mnt->mnt_parent = mnt;
877 mnt->mnt_mountpoint = mnt->mnt_root;
878 list_del_init(&mnt->mnt_child);
881 mnt->mnt_parent = mntget(nd->mnt);
882 mnt->mnt_mountpoint = dget(nd->dentry);
883 + PIN(nd->dentry, nd->mnt, 1);
884 list_add(&mnt->mnt_hash, mount_hashtable+hash(nd->mnt, nd->dentry));
885 list_add(&mnt->mnt_child, &nd->mnt->mnt_mounts);
886 nd->dentry->d_mounted++;
887 @@ -488,14 +490,17 @@
889 struct nameidata old_nd;
890 struct vfsmount *mnt = NULL;
891 + struct lookup_intent it = { .it_op = IT_GETATTR };
892 int err = mount_is_safe(nd);
895 if (!old_name || !*old_name)
897 - err = path_lookup(old_name, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &old_nd);
899 + err = path_lookup_it(old_name, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &old_nd, &it);
901 + intent_release(&it);
905 down_write(¤t->namespace->sem);
910 up_write(¤t->namespace->sem);
911 + intent_release(&it);
912 path_release(&old_nd);
916 unsigned long flags, void *data_page)
919 + struct lookup_intent it = { .it_op = IT_GETATTR };
923 @@ -725,10 +732,11 @@
924 flags &= ~(MS_NOSUID|MS_NOEXEC|MS_NODEV);
926 /* ... and get the mountpoint */
927 - retval = path_lookup(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd);
929 + retval = path_lookup_it(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd, &it);
931 + intent_release(&it);
935 if (flags & MS_REMOUNT)
936 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
940 retval = do_add_mount(&nd, type_page, flags, mnt_flags,
941 dev_name, data_page);
943 + intent_release(&it);
949 struct vfsmount *tmp;
950 struct nameidata new_nd, old_nd, parent_nd, root_parent, user_nd;
951 + struct lookup_intent new_it = { .it_op = IT_GETATTR };
952 + struct lookup_intent old_it = { .it_op = IT_GETATTR };
955 if (!capable(CAP_SYS_ADMIN))
956 @@ -911,14 +923,14 @@
960 - error = __user_walk(new_root, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &new_nd);
961 + error = __user_walk_it(new_root, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &new_nd, &new_it);
965 if (!check_mnt(new_nd.mnt))
968 - error = __user_walk(put_old, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &old_nd);
969 + error = __user_walk_it(put_old, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &old_nd, &old_it);
974 up(&old_nd.dentry->d_inode->i_zombie);
975 up_write(¤t->namespace->sem);
976 path_release(&user_nd);
977 + intent_release(&old_it);
978 path_release(&old_nd);
980 + intent_release(&new_it);
981 path_release(&new_nd);
984 Index: linux-2.4.21-suse2/fs/open.c
985 ===================================================================
986 --- linux-2.4.21-suse2.orig/fs/open.c 2003-10-28 21:33:59.000000000 +0300
987 +++ linux-2.4.21-suse2/fs/open.c 2004-01-10 12:55:39.000000000 +0300
989 #include <asm/uaccess.h>
991 #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
992 +extern int path_walk_it(const char *name, struct nameidata *nd,
993 + struct lookup_intent *it);
995 int vfs_statfs(struct super_block *sb, struct statfs *buf)
998 write_unlock(&files->file_lock);
1001 -int do_truncate(struct dentry *dentry, loff_t length)
1002 +int do_truncate(struct dentry *dentry, loff_t length, int called_from_open)
1004 struct inode *inode = dentry->d_inode;
1005 + struct inode_operations *op = dentry->d_inode->i_op;
1007 struct iattr newattrs;
1009 @@ -109,7 +112,13 @@
1010 down(&inode->i_sem);
1011 newattrs.ia_size = length;
1012 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
1013 - error = notify_change(dentry, &newattrs);
1014 + if (called_from_open)
1015 + newattrs.ia_valid |= ATTR_FROM_OPEN;
1016 + if (op->setattr_raw) {
1017 + newattrs.ia_valid |= ATTR_RAW;
1018 + error = op->setattr_raw(inode, &newattrs);
1020 + error = notify_change(dentry, &newattrs);
1022 up_write(&inode->i_alloc_sem);
1024 @@ -120,12 +129,13 @@
1025 struct nameidata nd;
1026 struct inode * inode;
1028 + struct lookup_intent it = { .it_op = IT_GETATTR };
1031 if (length < 0) /* sorry, but loff_t says... */
1034 - error = user_path_walk(path, &nd);
1035 + error = user_path_walk_it(path, &nd, &it);
1038 inode = nd.dentry->d_inode;
1039 @@ -165,11 +175,13 @@
1040 error = locks_verify_truncate(inode, NULL, length);
1043 - error = do_truncate(nd.dentry, length);
1044 + intent_release(&it);
1045 + error = do_truncate(nd.dentry, length, 0);
1047 put_write_access(inode);
1050 + intent_release(&it);
1056 error = locks_verify_truncate(inode, file, length);
1058 - error = do_truncate(dentry, length);
1059 + error = do_truncate(dentry, length, 0);
1063 @@ -262,11 +274,13 @@
1064 struct inode * inode;
1065 struct iattr newattrs;
1067 - error = user_path_walk(filename, &nd);
1068 + error = user_path_walk_it(filename, &nd, NULL);
1071 inode = nd.dentry->d_inode;
1073 + /* this is safe without a Lustre lock because it only depends
1074 + on the super block */
1076 if (IS_RDONLY(inode))
1078 @@ -281,11 +295,25 @@
1081 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
1085 + if (inode->i_op->setattr_raw) {
1086 + struct inode_operations *op = nd.dentry->d_inode->i_op;
1088 + newattrs.ia_valid |= ATTR_RAW;
1089 + error = op->setattr_raw(inode, &newattrs);
1090 + /* the file system wants to use normal vfs path now */
1091 + if (error != -EOPNOTSUPP)
1092 + goto dput_and_out;
1097 if (current->fsuid != inode->i_uid &&
1098 (error = permission(inode,MAY_WRITE)) != 0)
1102 error = notify_change(nd.dentry, &newattrs);
1105 @@ -306,12 +334,14 @@
1106 struct inode * inode;
1107 struct iattr newattrs;
1109 - error = user_path_walk(filename, &nd);
1110 + error = user_path_walk_it(filename, &nd, NULL);
1114 inode = nd.dentry->d_inode;
1116 + /* this is safe without a Lustre lock because it only depends
1117 + on the super block */
1119 if (IS_RDONLY(inode))
1121 @@ -326,7 +356,20 @@
1122 newattrs.ia_atime = times[0].tv_sec;
1123 newattrs.ia_mtime = times[1].tv_sec;
1124 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
1128 + if (inode->i_op->setattr_raw) {
1129 + struct inode_operations *op = nd.dentry->d_inode->i_op;
1131 + newattrs.ia_valid |= ATTR_RAW;
1132 + error = op->setattr_raw(inode, &newattrs);
1133 + /* the file system wants to use normal vfs path now */
1134 + if (error != -EOPNOTSUPP)
1135 + goto dput_and_out;
1140 if (current->fsuid != inode->i_uid &&
1141 (error = permission(inode,MAY_WRITE)) != 0)
1144 int old_fsuid, old_fsgid;
1145 kernel_cap_t old_cap;
1147 + struct lookup_intent it = { .it_op = IT_GETATTR };
1149 if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
1151 @@ -366,13 +410,14 @@
1153 current->cap_effective = current->cap_permitted;
1155 - res = user_path_walk(filename, &nd);
1156 + res = user_path_walk_it(filename, &nd, &it);
1158 res = permission(nd.dentry->d_inode, mode);
1159 /* SuS v2 requires we report a read only fs too */
1160 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
1161 && !special_file(nd.dentry->d_inode->i_mode))
1163 + intent_release(&it);
1170 struct nameidata nd;
1171 + struct lookup_intent it = { .it_op = IT_GETATTR };
1173 - error = __user_walk(filename,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd);
1174 + error = __user_walk_it(filename,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd, &it);
1179 set_fs_pwd(current->fs, nd.mnt, nd.dentry);
1182 + intent_release(&it);
1186 @@ -438,9 +485,10 @@
1189 struct nameidata nd;
1190 + struct lookup_intent it = { .it_op = IT_GETATTR };
1192 - error = __user_walk(filename, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
1193 - LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
1194 + error = __user_walk_it(filename, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
1195 + LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd, &it);
1199 @@ -456,39 +504,56 @@
1203 + intent_release(&it);
1209 -asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
1210 +int chmod_common(struct dentry *dentry, mode_t mode)
1212 - struct inode * inode;
1213 - struct dentry * dentry;
1214 - struct file * file;
1216 + struct inode *inode = dentry->d_inode;
1217 struct iattr newattrs;
1222 + if (IS_RDONLY(inode))
1225 - dentry = file->f_dentry;
1226 - inode = dentry->d_inode;
1227 + if (inode->i_op->setattr_raw) {
1228 + newattrs.ia_mode = mode;
1229 + newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1230 + newattrs.ia_valid |= ATTR_RAW;
1231 + err = inode->i_op->setattr_raw(inode, &newattrs);
1232 + /* the file system wants to use normal vfs path now */
1233 + if (err != -EOPNOTSUPP)
1238 - if (IS_RDONLY(inode))
1241 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1245 if (mode == (mode_t) -1)
1246 mode = inode->i_mode;
1247 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
1248 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1249 err = notify_change(dentry, &newattrs);
1256 +asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
1258 + struct file * file;
1265 + err = chmod_common(file->f_dentry, mode);
1270 @@ -497,30 +562,14 @@
1271 asmlinkage long sys_chmod(const char * filename, mode_t mode)
1273 struct nameidata nd;
1274 - struct inode * inode;
1276 - struct iattr newattrs;
1278 error = user_path_walk(filename, &nd);
1281 - inode = nd.dentry->d_inode;
1284 - if (IS_RDONLY(inode))
1285 - goto dput_and_out;
1288 - if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1289 - goto dput_and_out;
1290 + error = chmod_common(nd.dentry, mode);
1292 - if (mode == (mode_t) -1)
1293 - mode = inode->i_mode;
1294 - newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
1295 - newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1296 - error = notify_change(nd.dentry, &newattrs);
1302 @@ -540,6 +589,20 @@
1304 if (IS_RDONLY(inode))
1307 + if (inode->i_op->setattr_raw) {
1308 + struct inode_operations *op = dentry->d_inode->i_op;
1310 + newattrs.ia_uid = user;
1311 + newattrs.ia_gid = group;
1312 + newattrs.ia_valid = ATTR_UID | ATTR_GID | ATTR_CTIME;
1313 + newattrs.ia_valid |= ATTR_RAW;
1314 + error = op->setattr_raw(inode, &newattrs);
1315 + /* the file system wants to use normal vfs path now */
1316 + if (error != -EOPNOTSUPP)
1321 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1325 int namei_flags, error;
1326 struct nameidata nd;
1327 + struct lookup_intent it = { .it_op = IT_OPEN };
1329 namei_flags = flags;
1330 if ((namei_flags+1) & O_ACCMODE)
1331 @@ -651,14 +715,15 @@
1332 if (namei_flags & O_TRUNC)
1335 - error = open_namei(filename, namei_flags, mode, &nd);
1337 - return dentry_open(nd.dentry, nd.mnt, flags);
1338 + error = open_namei_it(filename, namei_flags, mode, &nd, &it);
1340 + return ERR_PTR(error);
1342 - return ERR_PTR(error);
1343 + return dentry_open_it(nd.dentry, nd.mnt, flags, &it);
1346 -struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1347 +struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1348 + int flags, struct lookup_intent *it)
1351 struct inode *inode;
1353 file_move(f, &inode->i_sb->s_files);
1355 if (f->f_op && f->f_op->open) {
1357 error = f->f_op->open(inode,f);
1363 !inode->i_mapping->a_ops->direct_IO))
1366 + intent_release(it);
1370 @@ -710,11 +778,17 @@
1374 + intent_release(it);
1377 return ERR_PTR(error);
1380 +struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1382 + return dentry_open_it(dentry, mnt, flags, NULL);
1386 * Find an empty file descriptor entry, and mark it busy.
1388 Index: linux-2.4.21-suse2/fs/stat.c
1389 ===================================================================
1390 --- linux-2.4.21-suse2.orig/fs/stat.c 2003-10-28 21:33:58.000000000 +0300
1391 +++ linux-2.4.21-suse2/fs/stat.c 2004-01-10 12:15:41.000000000 +0300
1393 * Revalidate the inode. This is required for proper NFS attribute caching.
1395 static __inline__ int
1396 -do_revalidate(struct dentry *dentry)
1397 +do_revalidate(struct dentry *dentry, struct lookup_intent *it)
1399 struct inode * inode = dentry->d_inode;
1400 - if (inode->i_op && inode->i_op->revalidate)
1403 + if (inode->i_op && inode->i_op->revalidate_it)
1404 + return inode->i_op->revalidate_it(dentry, it);
1405 + else if (inode->i_op && inode->i_op->revalidate)
1406 return inode->i_op->revalidate(dentry);
1409 @@ -141,13 +145,15 @@
1410 asmlinkage long sys_stat(char * filename, struct __old_kernel_stat * statbuf)
1412 struct nameidata nd;
1413 + struct lookup_intent it = { .it_op = IT_GETATTR };
1416 - error = user_path_walk(filename, &nd);
1417 + error = user_path_walk_it(filename, &nd, &it);
1419 - error = do_revalidate(nd.dentry);
1420 + error = do_revalidate(nd.dentry, &it);
1422 error = cp_old_stat(nd.dentry->d_inode, statbuf);
1423 + intent_release(&it);
1427 @@ -157,13 +163,15 @@
1428 asmlinkage long sys_newstat(char * filename, struct stat * statbuf)
1430 struct nameidata nd;
1431 + struct lookup_intent it = { .it_op = IT_GETATTR };
1434 - error = user_path_walk(filename, &nd);
1435 + error = user_path_walk_it(filename, &nd, &it);
1437 - error = do_revalidate(nd.dentry);
1438 + error = do_revalidate(nd.dentry, &it);
1440 error = cp_new_stat(nd.dentry->d_inode, statbuf);
1441 + intent_release(&it);
1445 @@ -178,13 +186,15 @@
1446 asmlinkage long sys_lstat(char * filename, struct __old_kernel_stat * statbuf)
1448 struct nameidata nd;
1449 + struct lookup_intent it = { .it_op = IT_GETATTR };
1452 - error = user_path_walk_link(filename, &nd);
1453 + error = user_path_walk_link_it(filename, &nd, &it);
1455 - error = do_revalidate(nd.dentry);
1456 + error = do_revalidate(nd.dentry, &it);
1458 error = cp_old_stat(nd.dentry->d_inode, statbuf);
1459 + intent_release(&it);
1463 @@ -195,13 +205,15 @@
1464 asmlinkage long sys_newlstat(char * filename, struct stat * statbuf)
1466 struct nameidata nd;
1467 + struct lookup_intent it = { .it_op = IT_GETATTR };
1470 - error = user_path_walk_link(filename, &nd);
1471 + error = user_path_walk_link_it(filename, &nd, &it);
1473 - error = do_revalidate(nd.dentry);
1474 + error = do_revalidate(nd.dentry, &it);
1476 error = cp_new_stat(nd.dentry->d_inode, statbuf);
1477 + intent_release(&it);
1483 struct dentry * dentry = f->f_dentry;
1485 - err = do_revalidate(dentry);
1486 + err = do_revalidate(dentry, NULL);
1488 err = cp_old_stat(dentry->d_inode, statbuf);
1492 struct dentry * dentry = f->f_dentry;
1494 - err = do_revalidate(dentry);
1495 + err = do_revalidate(dentry, NULL);
1497 err = cp_new_stat(dentry->d_inode, statbuf);
1502 if (inode->i_op && inode->i_op->readlink &&
1503 - !(error = do_revalidate(nd.dentry))) {
1504 + !(error = do_revalidate(nd.dentry, NULL))) {
1505 UPDATE_ATIME(inode);
1506 error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
1508 @@ -339,12 +351,14 @@
1510 struct nameidata nd;
1512 + struct lookup_intent it = { .it_op = IT_GETATTR };
1514 - error = user_path_walk(filename, &nd);
1515 + error = user_path_walk_it(filename, &nd, &it);
1517 - error = do_revalidate(nd.dentry);
1518 + error = do_revalidate(nd.dentry, &it);
1520 error = cp_new_stat64(nd.dentry->d_inode, statbuf);
1521 + intent_release(&it);
1525 @@ -354,12 +368,14 @@
1527 struct nameidata nd;
1529 + struct lookup_intent it = { .it_op = IT_GETATTR };
1531 - error = user_path_walk_link(filename, &nd);
1532 + error = user_path_walk_link_it(filename, &nd, &it);
1534 - error = do_revalidate(nd.dentry);
1535 + error = do_revalidate(nd.dentry, &it);
1537 error = cp_new_stat64(nd.dentry->d_inode, statbuf);
1538 + intent_release(&it);
1544 struct dentry * dentry = f->f_dentry;
1546 - err = do_revalidate(dentry);
1547 + err = do_revalidate(dentry, NULL);
1549 err = cp_new_stat64(dentry->d_inode, statbuf);
1551 Index: linux-2.4.21-suse2/include/linux/dcache.h
1552 ===================================================================
1553 --- linux-2.4.21-suse2.orig/include/linux/dcache.h 2003-11-11 03:44:28.000000000 +0300
1554 +++ linux-2.4.21-suse2/include/linux/dcache.h 2004-01-10 12:48:36.000000000 +0300
1556 #include <linux/gdb.h>
1557 #include <linux/mount.h>
1558 #include <linux/kernel.h>
1559 +#include <linux/string.h>
1561 +#define IT_OPEN 0x0001
1562 +#define IT_CREAT 0x0002
1563 +#define IT_READDIR 0x0004
1564 +#define IT_GETATTR 0x0008
1565 +#define IT_LOOKUP 0x0010
1566 +#define IT_UNLINK 0x0020
1567 +#define IT_GETXATTR 0x0040
1568 +#define IT_EXEC 0x0080
1569 +#define IT_PIN 0x0100
1571 +#define IT_FL_LOCKED 0x0001
1572 +#define IT_FL_FOLLOWED 0x0002 /* set by vfs_follow_link */
1574 +#define INTENT_MAGIC 0x19620323
1577 +struct lustre_intent_data {
1578 + int it_disposition;
1580 + __u64 it_lock_handle;
1585 +struct lookup_intent {
1587 + void (*it_op_release)(struct lookup_intent *);
1590 + int it_create_mode;
1592 + struct lustre_intent_data lustre;
1596 +static inline void intent_init(struct lookup_intent *it, int op, int flags)
1598 + memset(it, 0, sizeof(*it));
1599 + it->it_magic = INTENT_MAGIC;
1601 + it->it_flags = flags;
1606 * linux/include/linux/dcache.h
1608 int (*d_delete)(struct dentry *);
1609 void (*d_release)(struct dentry *);
1610 void (*d_iput)(struct dentry *, struct inode *);
1611 + int (*d_revalidate_it)(struct dentry *, int, struct lookup_intent *);
1612 + void (*d_pin)(struct dentry *, struct vfsmount * , int);
1613 + void (*d_unpin)(struct dentry *, struct vfsmount *, int);
1616 +#define PIN(de,mnt,flag) if (de && de->d_op && de->d_op->d_pin) \
1617 + de->d_op->d_pin(de, mnt, flag);
1618 +#define UNPIN(de,mnt,flag) if (de && de->d_op && de->d_op->d_unpin) \
1619 + de->d_op->d_unpin(de, mnt, flag);
1622 +/* defined in fs/namei.c */
1623 +extern void intent_release(struct lookup_intent *it);
1624 +/* defined in fs/dcache.c */
1625 +extern void __d_rehash(struct dentry * entry, int lock);
1627 /* the dentry parameter passed to d_hash and d_compare is the parent
1628 * directory of the entries to be compared. It is used in case these
1629 * functions need any directory specific information for determining
1631 * s_nfsd_free_path semaphore will be down
1633 #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
1634 +#define DCACHE_LUSTRE_INVALID 0x0010 /* Lustre invalidated */
1636 extern spinlock_t dcache_lock;
1638 Index: linux-2.4.21-suse2/include/linux/fs.h
1639 ===================================================================
1640 --- linux-2.4.21-suse2.orig/include/linux/fs.h 2004-01-10 11:28:05.000000000 +0300
1641 +++ linux-2.4.21-suse2/include/linux/fs.h 2004-01-10 12:48:36.000000000 +0300
1644 #define FMODE_READ 1
1645 #define FMODE_WRITE 2
1646 +#define FMODE_EXEC 4
1651 #define ATTR_MTIME_SET 256
1652 #define ATTR_FORCE 512 /* Not a change, but a change it */
1653 #define ATTR_ATTR_FLAG 1024
1654 +#define ATTR_RAW 0x0800 /* file system, not vfs will massage attrs */
1655 +#define ATTR_FROM_OPEN 0x1000 /* called from open path, ie O_TRUNC */
1656 +#define ATTR_CTIME_SET 0x2000
1659 * This is the Inode Attributes structure, used for notify_change(). It
1661 struct pipe_inode_info *i_pipe;
1662 struct block_device *i_bdev;
1663 struct char_device *i_cdev;
1664 + void *i_filterdata;
1666 unsigned long i_dnotify_mask; /* Directory notify events */
1667 struct dnotify_struct *i_dnotify; /* for directory notifications */
1670 /* needed for tty driver, and maybe others */
1672 + struct lookup_intent *f_it;
1673 struct list_head f_ep_links;
1674 spinlock_t f_ep_lock;
1680 + struct lookup_intent *intent;
1685 extern int __vfs_rmdir(struct inode *, struct dentry *);
1686 extern int vfs_rmdir(struct inode *, struct dentry *);
1687 extern int vfs_unlink(struct inode *, struct dentry *);
1688 -extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
1689 +int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1690 + struct inode *new_dir, struct dentry *new_dentry);
1694 @@ -992,21 +1000,32 @@
1696 struct inode_operations {
1697 int (*create) (struct inode *,struct dentry *,int);
1698 + int (*create_it) (struct inode *,struct dentry *,int, struct lookup_intent *);
1699 struct dentry * (*lookup) (struct inode *,struct dentry *);
1700 + struct dentry * (*lookup_it) (struct inode *,struct dentry *, struct lookup_intent *, int flags);
1701 int (*link) (struct dentry *,struct inode *,struct dentry *);
1702 + int (*link_raw) (struct nameidata *,struct nameidata *);
1703 int (*unlink) (struct inode *,struct dentry *);
1704 + int (*unlink_raw) (struct nameidata *);
1705 int (*symlink) (struct inode *,struct dentry *,const char *);
1706 + int (*symlink_raw) (struct nameidata *,const char *);
1707 int (*mkdir) (struct inode *,struct dentry *,int);
1708 + int (*mkdir_raw) (struct nameidata *,int);
1709 int (*rmdir) (struct inode *,struct dentry *);
1710 + int (*rmdir_raw) (struct nameidata *);
1711 int (*mknod) (struct inode *,struct dentry *,int,int);
1712 + int (*mknod_raw) (struct nameidata *,int,dev_t);
1713 int (*rename) (struct inode *, struct dentry *,
1714 struct inode *, struct dentry *);
1715 + int (*rename_raw) (struct nameidata *, struct nameidata *);
1716 int (*readlink) (struct dentry *, char *,int);
1717 int (*follow_link) (struct dentry *, struct nameidata *);
1718 void (*truncate) (struct inode *);
1719 int (*permission) (struct inode *, int);
1720 int (*revalidate) (struct dentry *);
1721 + int (*revalidate_it) (struct dentry *, struct lookup_intent *);
1722 int (*setattr) (struct dentry *, struct iattr *);
1723 + int (*setattr_raw) (struct inode *, struct iattr *);
1724 int (*getattr) (struct dentry *, struct iattr *);
1725 int (*setxattr) (struct dentry *, const char *, const void *, size_t, int);
1726 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
1727 @@ -1205,10 +1224,14 @@
1729 asmlinkage long sys_open(const char *, int, int);
1730 asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
1731 -extern int do_truncate(struct dentry *, loff_t start);
1732 +extern int do_truncate(struct dentry *, loff_t start, int called_from_open);
1734 extern struct file *filp_open(const char *, int, int);
1735 extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
1736 +extern int open_namei_it(const char *filename, int namei_flags, int mode,
1737 + struct nameidata *nd, struct lookup_intent *it);
1738 +extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1739 + int flags, struct lookup_intent *it);
1740 extern int filp_close(struct file *, fl_owner_t id);
1741 extern char * getname(const char *);
1743 @@ -1504,6 +1527,7 @@
1744 extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
1746 extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
1747 +extern int FASTCALL(__user_walk_it(const char *, unsigned, struct nameidata *, struct lookup_intent *it));
1748 extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
1749 extern int FASTCALL(path_walk(const char *, struct nameidata *));
1750 extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
1751 @@ -1516,6 +1540,8 @@
1752 extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
1753 #define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
1754 #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
1755 +#define user_path_walk_it(name,nd,it) __user_walk_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd, it)
1756 +#define user_path_walk_link_it(name,nd,it) __user_walk_it(name, LOOKUP_POSITIVE, nd, it)
1758 extern void inode_init_once(struct inode *);
1759 extern void _inode_init_once(struct inode *);
1760 @@ -1667,6 +1693,8 @@
1762 extern int vfs_readlink(struct dentry *, char *, int, const char *);
1763 extern int vfs_follow_link(struct nameidata *, const char *);
1764 +extern int vfs_follow_link_it(struct nameidata *, const char *,
1765 + struct lookup_intent *it);
1766 extern int page_readlink(struct dentry *, char *, int);
1767 extern int page_follow_link(struct dentry *, struct nameidata *);
1768 extern struct inode_operations page_symlink_inode_operations;
1769 Index: linux-2.4.21-suse2/include/linux/fs_struct.h
1770 ===================================================================
1771 --- linux-2.4.21-suse2.orig/include/linux/fs_struct.h 2001-07-14 02:10:44.000000000 +0400
1772 +++ linux-2.4.21-suse2/include/linux/fs_struct.h 2004-01-10 12:15:41.000000000 +0300
1774 write_lock(&fs->lock);
1775 old_root = fs->root;
1776 old_rootmnt = fs->rootmnt;
1777 + PIN(dentry, mnt, 1);
1778 fs->rootmnt = mntget(mnt);
1779 fs->root = dget(dentry);
1780 write_unlock(&fs->lock);
1782 + UNPIN(old_root, old_rootmnt, 1);
1784 mntput(old_rootmnt);
1787 write_lock(&fs->lock);
1789 old_pwdmnt = fs->pwdmnt;
1790 + PIN(dentry, mnt, 0);
1791 fs->pwdmnt = mntget(mnt);
1792 fs->pwd = dget(dentry);
1793 write_unlock(&fs->lock);
1795 + UNPIN(old_pwd, old_pwdmnt, 0);
1799 Index: linux-2.4.21-suse2/kernel/exit.c
1800 ===================================================================
1801 --- linux-2.4.21-suse2.orig/kernel/exit.c 2003-10-28 21:34:13.000000000 +0300
1802 +++ linux-2.4.21-suse2/kernel/exit.c 2004-01-10 12:15:41.000000000 +0300
1803 @@ -288,11 +288,14 @@
1805 /* No need to hold fs->lock if we are killing it */
1806 if (atomic_dec_and_test(&fs->count)) {
1807 + UNPIN(fs->pwd, fs->pwdmnt, 0);
1808 + UNPIN(fs->root, fs->rootmnt, 1);
1810 mntput(fs->rootmnt);
1814 + UNPIN(fs->altroot, fs->altrootmnt, 1);
1816 mntput(fs->altrootmnt);
1818 Index: linux-2.4.21-suse2/kernel/fork.c
1819 ===================================================================
1820 --- linux-2.4.21-suse2.orig/kernel/fork.c 2003-10-28 21:34:17.000000000 +0300
1821 +++ linux-2.4.21-suse2/kernel/fork.c 2004-01-10 12:15:41.000000000 +0300
1822 @@ -461,10 +461,13 @@
1823 fs->umask = old->umask;
1824 read_lock(&old->lock);
1825 fs->rootmnt = mntget(old->rootmnt);
1826 + PIN(old->pwd, old->pwdmnt, 0);
1827 + PIN(old->root, old->rootmnt, 1);
1828 fs->root = dget(old->root);
1829 fs->pwdmnt = mntget(old->pwdmnt);
1830 fs->pwd = dget(old->pwd);
1832 + PIN(old->altroot, old->altrootmnt, 1);
1833 fs->altrootmnt = mntget(old->altrootmnt);
1834 fs->altroot = dget(old->altroot);
1836 Index: linux-2.4.21-suse2/kernel/ksyms.c
1837 ===================================================================
1838 --- linux-2.4.21-suse2.orig/kernel/ksyms.c 2004-01-10 11:28:05.000000000 +0300
1839 +++ linux-2.4.21-suse2/kernel/ksyms.c 2004-01-10 12:15:41.000000000 +0300
1841 EXPORT_SYMBOL(set_page_dirty);
1842 EXPORT_SYMBOL(vfs_readlink);
1843 EXPORT_SYMBOL(vfs_follow_link);
1844 +EXPORT_SYMBOL(vfs_follow_link_it);
1845 EXPORT_SYMBOL(page_readlink);
1846 EXPORT_SYMBOL(page_follow_link);
1847 EXPORT_SYMBOL(page_symlink_inode_operations);