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/exec.c
16 ===================================================================
17 --- linux-2.4.19.SuSE.orig/fs/exec.c Mon Jan 27 05:08:35 2003
18 +++ linux-2.4.19.SuSE/fs/exec.c Sat Nov 15 17:34:06 2003
23 + struct lookup_intent it = { .it_op = IT_OPEN,
24 + .it_flags = FMODE_READ|FMODE_EXEC };
26 - error = user_path_walk(library, &nd);
27 + error = user_path_walk_it(library, &nd, &it);
35 - file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
36 + file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it);
37 + intent_release(&it);
38 error = PTR_ERR(file);
45 + struct lookup_intent it = { .it_op = IT_OPEN,
46 + .it_flags = FMODE_READ|FMODE_EXEC };
48 if (path_init(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd))
49 - err = path_walk(name, &nd);
50 + err = path_walk_it(name, &nd, &it);
53 inode = nd.dentry->d_inode;
58 - file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
59 + file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it);
60 + intent_release(&it);
62 err = deny_write_access(file);
68 + intent_release(&it);
74 if (!file->f_op->write)
76 - if (do_truncate(file->f_dentry, 0) != 0)
77 + if (do_truncate(file->f_dentry, 0, 0) != 0)
80 retval = binfmt->core_dump(signr, regs, file);
81 Index: linux-2.4.19.SuSE/fs/dcache.c
82 ===================================================================
83 --- linux-2.4.19.SuSE.orig/fs/dcache.c Mon Jan 27 05:08:04 2003
84 +++ linux-2.4.19.SuSE/fs/dcache.c Sat Nov 15 17:29:03 2003
86 spin_unlock(&dcache_lock);
90 + /* network invalidation by Lustre */
91 + if (dentry->d_flags & DCACHE_LUSTRE_INVALID) {
92 + spin_unlock(&dcache_lock);
97 * Check whether to do a partial shrink_dcache
98 * to get rid of unused child entries.
100 * Adds a dentry to the hash according to its name.
103 -void d_rehash(struct dentry * entry)
104 +void __d_rehash(struct dentry * entry, int lock)
106 struct list_head *list = d_hash(entry->d_parent, entry->d_name.hash);
107 if (!list_empty(&entry->d_hash)) BUG();
108 - spin_lock(&dcache_lock);
109 + if (lock) spin_lock(&dcache_lock);
110 list_add(&entry->d_hash, list);
111 - spin_unlock(&dcache_lock);
112 + if (lock) spin_unlock(&dcache_lock);
114 +EXPORT_SYMBOL(__d_rehash);
116 +void d_rehash(struct dentry * entry)
118 + __d_rehash(entry, 1);
121 #define do_switch(x,y) do { \
122 Index: linux-2.4.19.SuSE/fs/namespace.c
123 ===================================================================
124 --- linux-2.4.19.SuSE.orig/fs/namespace.c Mon Jan 27 05:08:07 2003
125 +++ linux-2.4.19.SuSE/fs/namespace.c Sat Nov 15 17:56:42 2003
128 old_nd->dentry = mnt->mnt_mountpoint;
129 old_nd->mnt = mnt->mnt_parent;
130 + UNPIN(old_nd->dentry, old_nd->mnt, 1);
131 mnt->mnt_parent = mnt;
132 mnt->mnt_mountpoint = mnt->mnt_root;
133 list_del_init(&mnt->mnt_child);
136 mnt->mnt_parent = mntget(nd->mnt);
137 mnt->mnt_mountpoint = dget(nd->dentry);
138 + PIN(nd->dentry, nd->mnt, 1);
139 list_add(&mnt->mnt_hash, mount_hashtable+hash(nd->mnt, nd->dentry));
140 list_add(&mnt->mnt_child, &nd->mnt->mnt_mounts);
141 nd->dentry->d_mounted++;
142 @@ -491,15 +493,18 @@
144 struct nameidata old_nd;
145 struct vfsmount *mnt = NULL;
146 + struct lookup_intent it = { .it_op = IT_GETATTR };
147 int err = mount_is_safe(nd);
150 if (!old_name || !*old_name)
152 if (path_init(old_name, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &old_nd))
153 - err = path_walk(old_name, &old_nd);
155 + err = path_walk_it(old_name, &old_nd, &it);
157 + intent_release(&it);
161 down_write(¤t->namespace->sem);
166 up_write(¤t->namespace->sem);
167 + intent_release(&it);
168 path_release(&old_nd);
172 unsigned long flags, void *data_page)
175 + struct lookup_intent it = { .it_op = IT_GETATTR };
181 /* ... and get the mountpoint */
182 if (path_init(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd))
183 - retval = path_walk(dir_name, &nd);
185 + retval = path_walk_it(dir_name, &nd, &it);
187 + intent_release(&it);
191 if (flags & MS_REMOUNT)
192 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
195 retval = do_add_mount(&nd, type_page, flags, mnt_flags,
196 dev_name, data_page);
198 + intent_release(&it);
204 struct vfsmount *tmp;
205 struct nameidata new_nd, old_nd, parent_nd, root_parent, user_nd;
206 + struct lookup_intent new_it = { .it_op = IT_GETATTR };
207 + struct lookup_intent old_it = { .it_op = IT_GETATTR };
214 if (path_init(name, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &new_nd))
215 - error = path_walk(name, &new_nd);
216 + error = path_walk_it(name, &new_nd, &new_it);
223 if (path_init(name, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &old_nd))
224 - error = path_walk(name, &old_nd);
225 + error = path_walk_it(name, &old_nd, &old_it);
229 @@ -1013,8 +1026,10 @@
230 up(&old_nd.dentry->d_inode->i_zombie);
231 up_write(¤t->namespace->sem);
232 path_release(&user_nd);
233 + intent_release(&old_it);
234 path_release(&old_nd);
236 + intent_release(&new_it);
237 path_release(&new_nd);
240 Index: linux-2.4.19.SuSE/fs/namei.c
241 ===================================================================
242 --- linux-2.4.19.SuSE.orig/fs/namei.c Mon Jan 27 05:08:07 2003
243 +++ linux-2.4.19.SuSE/fs/namei.c Sat Nov 15 17:52:03 2003
245 * XEmacs seems to be relying on it...
248 +void intent_release(struct lookup_intent *it)
250 + if (it && it->it_op_release)
251 + it->it_op_release(it);
255 /* In order to reduce some races, while at the same time doing additional
256 * checking and hopefully speeding things up, we copy filenames to the
257 * kernel data space before using them..
258 @@ -260,10 +267,19 @@
259 * Internal lookup() using the new generic dcache.
262 -static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name, int flags)
263 +static struct dentry *cached_lookup(struct dentry *parent, struct qstr *name,
264 + int flags, struct lookup_intent *it)
266 struct dentry * dentry = d_lookup(parent, name);
268 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
269 + if (!dentry->d_op->d_revalidate_it(dentry, flags, it) &&
270 + !d_invalidate(dentry)) {
276 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
277 if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) {
279 @@ -281,11 +297,15 @@
280 * make sure that nobody added the entry to the dcache in the meantime..
283 -static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, int flags)
284 +static struct dentry *real_lookup(struct dentry *parent, struct qstr *name,
285 + int flags, struct lookup_intent *it)
287 struct dentry * result;
288 struct inode *dir = parent->d_inode;
295 * First re-do the cached lookup just in case it was created
297 result = ERR_PTR(-ENOMEM);
300 + if (dir->i_op->lookup_it)
301 + result = dir->i_op->lookup_it(dir, dentry, it, flags);
303 result = dir->i_op->lookup(dir, dentry);
308 result = ERR_PTR(-ENOENT);
310 + } else if (result->d_op && result->d_op->d_revalidate_it) {
311 + if (!result->d_op->d_revalidate_it(result, flags, it) &&
312 + !d_invalidate(result)) {
315 + result = ERR_PTR(-ESTALE);
316 + if (!IS_ERR(result))
323 * Without that kind of total limit, nasty chains of consecutive
324 * symlinks can cause almost arbitrarily long lookups.
326 -static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
327 +static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd,
328 + struct lookup_intent *it)
331 if (current->link_count >= 8)
332 @@ -346,10 +379,12 @@
333 current->link_count++;
334 current->total_link_count++;
335 UPDATE_ATIME(dentry->d_inode);
337 err = dentry->d_inode->i_op->follow_link(dentry, nd);
338 current->link_count--;
341 + intent_release(it);
347 * We expect 'base' to be positive and a directory.
349 -int link_path_walk(const char * name, struct nameidata *nd)
350 +int link_path_walk_it(const char *name, struct nameidata *nd,
351 + struct lookup_intent *it)
353 struct dentry *dentry;
355 @@ -524,12 +560,13 @@
358 /* This does the actual lookups.. */
359 - dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
360 + dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE,NULL);
362 err = -EWOULDBLOCKIO;
365 - dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
366 + dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE,
368 err = PTR_ERR(dentry);
374 if (inode->i_op->follow_link) {
375 - err = do_follow_link(dentry, nd);
376 + err = do_follow_link(dentry, nd, NULL);
384 - if (!inode->i_op->lookup)
385 + if (!inode->i_op->lookup && !inode->i_op->lookup_it)
388 /* here ends the main loop */
389 @@ -590,12 +627,12 @@
393 - dentry = cached_lookup(nd->dentry, &this, 0);
394 + dentry = cached_lookup(nd->dentry, &this, 0, it);
396 err = -EWOULDBLOCKIO;
399 - dentry = real_lookup(nd->dentry, &this, 0);
400 + dentry = real_lookup(nd->dentry, &this, 0, it);
401 err = PTR_ERR(dentry);
405 inode = dentry->d_inode;
406 if ((lookup_flags & LOOKUP_FOLLOW)
407 && inode && inode->i_op && inode->i_op->follow_link) {
408 - err = do_follow_link(dentry, nd);
409 + err = do_follow_link(dentry, nd, it);
415 if (lookup_flags & LOOKUP_DIRECTORY) {
417 - if (!inode->i_op || !inode->i_op->lookup)
418 + if (!inode->i_op ||
419 + (!inode->i_op->lookup && !inode->i_op->lookup_it))
424 * Check the cached dentry for staleness.
427 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
429 + if (!dentry->d_op->d_revalidate_it(dentry, 0, it)) {
430 + struct dentry *new;
431 + err = permission(dentry->d_parent->d_inode,
435 + new = real_lookup(dentry->d_parent,
436 + &dentry->d_name, 0, NULL);
437 + d_invalidate(dentry);
440 + err = PTR_ERR(new);
446 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
448 if (!dentry->d_op->d_revalidate(dentry, lookup_flags & LOOKUP_PARENT)) {
449 @@ -656,15 +713,28 @@
454 + intent_release(it);
460 +int link_path_walk(const char * name, struct nameidata *nd)
462 + return link_path_walk_it(name, nd, NULL);
465 +int path_walk_it(const char * name, struct nameidata *nd, struct lookup_intent *it)
467 + current->total_link_count = 0;
468 + return link_path_walk_it(name, nd, it);
471 int path_walk(const char * name, struct nameidata *nd)
473 current->total_link_count = 0;
474 - return link_path_walk(name, nd);
475 + return link_path_walk_it(name, nd, NULL);
481 nd->last_type = LAST_ROOT; /* if there are only slashes... */
485 return walk_init_root(name,nd);
486 read_lock(¤t->fs->lock);
488 * needs parent already locked. Doesn't follow mounts.
491 -struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
492 +struct dentry * lookup_hash_it(struct qstr *name, struct dentry * base,
493 + struct lookup_intent *it)
495 struct dentry * dentry;
497 @@ -790,13 +862,16 @@
501 - dentry = cached_lookup(base, name, 0);
502 + dentry = cached_lookup(base, name, 0, it);
504 struct dentry *new = d_alloc(base, name);
505 dentry = ERR_PTR(-ENOMEM);
509 + if (inode->i_op->lookup_it)
510 + dentry = inode->i_op->lookup_it(inode, new, it, 0);
512 dentry = inode->i_op->lookup(inode, new);
519 +struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
521 + return lookup_hash_it(name, base, NULL);
526 struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
530 this.hash = end_name_hash(hash);
532 - return lookup_hash(&this, base);
533 + return lookup_hash_it(&this, base, NULL);
535 return ERR_PTR(-EACCES);
541 +int __user_walk_it(const char *name, unsigned flags, struct nameidata *nd,
542 + struct lookup_intent *it)
547 + tmp = getname(name);
548 + err = PTR_ERR(tmp);
549 + if (!IS_ERR(tmp)) {
551 + if (path_init(tmp, flags, nd))
552 + err = path_walk_it(tmp, nd, it);
559 * It's inline, so penalty for filesystems that don't use sticky bit is
565 -int vfs_create(struct inode *dir, struct dentry *dentry, int mode)
566 +static int vfs_create_it(struct inode *dir, struct dentry *dentry, int mode,
567 + struct lookup_intent *it)
571 @@ -971,12 +1070,15 @@
574 error = -EACCES; /* shouldn't it be ENOSYS? */
575 - if (!dir->i_op || !dir->i_op->create)
576 + if (!dir->i_op || (!dir->i_op->create && !dir->i_op->create_it))
581 - error = dir->i_op->create(dir, dentry, mode);
582 + if (dir->i_op->create_it)
583 + error = dir->i_op->create_it(dir, dentry, mode, it);
585 + error = dir->i_op->create(dir, dentry, mode);
589 @@ -985,6 +1087,11 @@
593 +int vfs_create(struct inode *dir, struct dentry *dentry, int mode)
595 + return vfs_create_it(dir, dentry, mode, NULL);
602 * for symlinks (where the permissions are checked later).
605 -int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
606 +int open_namei_it(const char *pathname, int flag, int mode,
607 + struct nameidata *nd, struct lookup_intent *it)
609 int acc_mode, error = 0;
611 @@ -1009,12 +1117,14 @@
613 acc_mode = ACC_MODE(flag);
616 + it->it_flags = flag;
618 * The simplest case - just a plain lookup.
620 if (!(flag & O_CREAT)) {
621 if (path_init(pathname, lookup_flags(flag), nd))
622 - error = path_walk(pathname, nd);
623 + error = path_walk_it(pathname, nd, it);
627 @@ -1024,6 +1134,10 @@
629 * Create - we need to know the parent.
632 + it->it_create_mode = mode;
633 + it->it_op |= IT_CREAT;
635 if (path_init(pathname, LOOKUP_PARENT, nd))
636 error = path_walk(pathname, nd);
638 @@ -1040,7 +1154,7 @@
641 down(&dir->d_inode->i_sem);
642 - dentry = lookup_hash(&nd->last, nd->dentry);
643 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
646 error = PTR_ERR(dentry);
647 @@ -1049,11 +1163,13 @@
651 + it->it_create_mode = mode;
652 /* Negative dentry, just create the file */
653 if (!dentry->d_inode) {
654 if (!IS_POSIXACL(dir->d_inode))
655 mode &= ~current->fs->umask;
656 - error = vfs_create(dir->d_inode, dentry, mode);
657 + error = vfs_create_it(dir->d_inode, dentry,
658 + mode & ~current->fs->umask, it);
659 up(&dir->d_inode->i_sem);
660 #ifndef DENTRY_WASTE_RAM
662 @@ -1161,7 +1277,7 @@
666 - error = do_truncate(dentry, 0);
667 + error = do_truncate(dentry, 0, 1);
669 put_write_access(inode);
671 @@ -1173,8 +1289,10 @@
675 + intent_release(it);
678 + intent_release(it);
682 @@ -1193,7 +1311,10 @@
683 * are done. Procfs-like symlinks just set LAST_BIND.
685 UPDATE_ATIME(dentry->d_inode);
687 error = dentry->d_inode->i_op->follow_link(dentry, nd);
689 + intent_release(it);
693 @@ -1215,13 +1336,20 @@
696 down(&dir->d_inode->i_sem);
697 - dentry = lookup_hash(&nd->last, nd->dentry);
698 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
699 putname(nd->last.name);
703 +int open_namei(const char *pathname, int flag, int mode, struct nameidata *nd)
705 + return open_namei_it(pathname, flag, mode, nd, NULL);
710 -static struct dentry *lookup_create(struct nameidata *nd, int is_dir)
711 +static struct dentry *lookup_create(struct nameidata *nd, int is_dir,
712 + struct lookup_intent *it)
714 struct dentry *dentry;
716 @@ -1229,7 +1357,7 @@
717 dentry = ERR_PTR(-EEXIST);
718 if (nd->last_type != LAST_NORM)
720 - dentry = lookup_hash(&nd->last, nd->dentry);
721 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
724 if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
725 @@ -1286,7 +1414,16 @@
726 error = path_walk(tmp, &nd);
729 - dentry = lookup_create(&nd, 0);
731 + if (nd.dentry->d_inode->i_op->mknod_raw) {
732 + struct inode_operations *op = nd.dentry->d_inode->i_op;
733 + error = op->mknod_raw(&nd, mode, dev);
734 + /* the file system wants to use normal vfs path now */
735 + if (error != -EOPNOTSUPP)
739 + dentry = lookup_create(&nd, 0, NULL);
740 error = PTR_ERR(dentry);
742 if (!IS_POSIXACL(nd.dentry->d_inode))
743 @@ -1308,6 +1445,7 @@
746 up(&nd.dentry->d_inode->i_sem);
751 @@ -1356,7 +1494,14 @@
752 error = path_walk(tmp, &nd);
755 - dentry = lookup_create(&nd, 1);
756 + if (nd.dentry->d_inode->i_op->mkdir_raw) {
757 + struct inode_operations *op = nd.dentry->d_inode->i_op;
758 + error = op->mkdir_raw(&nd, mode);
759 + /* the file system wants to use normal vfs path now */
760 + if (error != -EOPNOTSUPP)
763 + dentry = lookup_create(&nd, 1, NULL);
764 error = PTR_ERR(dentry);
765 if (!IS_ERR(dentry)) {
766 if (!IS_POSIXACL(nd.dentry->d_inode))
767 @@ -1365,6 +1510,7 @@
770 up(&nd.dentry->d_inode->i_sem);
775 @@ -1466,8 +1612,16 @@
779 + if (nd.dentry->d_inode->i_op->rmdir_raw) {
780 + struct inode_operations *op = nd.dentry->d_inode->i_op;
782 + error = op->rmdir_raw(&nd);
783 + /* the file system wants to use normal vfs path now */
784 + if (error != -EOPNOTSUPP)
787 down(&nd.dentry->d_inode->i_sem);
788 - dentry = lookup_hash(&nd.last, nd.dentry);
789 + dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
790 error = PTR_ERR(dentry);
791 if (!IS_ERR(dentry)) {
792 error = vfs_rmdir(nd.dentry->d_inode, dentry);
793 @@ -1526,8 +1680,15 @@
795 if (nd.last_type != LAST_NORM)
797 + if (nd.dentry->d_inode->i_op->unlink_raw) {
798 + struct inode_operations *op = nd.dentry->d_inode->i_op;
799 + error = op->unlink_raw(&nd);
800 + /* the file system wants to use normal vfs path now */
801 + if (error != -EOPNOTSUPP)
804 down(&nd.dentry->d_inode->i_sem);
805 - dentry = lookup_hash(&nd.last, nd.dentry);
806 + dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
807 error = PTR_ERR(dentry);
808 if (!IS_ERR(dentry)) {
809 /* Why not before? Because we want correct error value */
810 @@ -1595,15 +1756,23 @@
811 error = path_walk(to, &nd);
814 - dentry = lookup_create(&nd, 0);
815 + if (nd.dentry->d_inode->i_op->symlink_raw) {
816 + struct inode_operations *op = nd.dentry->d_inode->i_op;
817 + error = op->symlink_raw(&nd, from);
818 + /* the file system wants to use normal vfs path now */
819 + if (error != -EOPNOTSUPP)
822 + dentry = lookup_create(&nd, 0, NULL);
823 error = PTR_ERR(dentry);
824 if (!IS_ERR(dentry)) {
825 error = vfs_symlink(nd.dentry->d_inode, dentry, from);
828 up(&nd.dentry->d_inode->i_sem);
836 @@ -1686,7 +1855,14 @@
838 if (old_nd.mnt != nd.mnt)
840 - new_dentry = lookup_create(&nd, 0);
841 + if (nd.dentry->d_inode->i_op->link_raw) {
842 + struct inode_operations *op = nd.dentry->d_inode->i_op;
843 + error = op->link_raw(&old_nd, &nd);
844 + /* the file system wants to use normal vfs path now */
845 + if (error != -EOPNOTSUPP)
848 + new_dentry = lookup_create(&nd, 0, NULL);
849 error = PTR_ERR(new_dentry);
850 if (!IS_ERR(new_dentry)) {
851 error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
852 @@ -1732,7 +1908,7 @@
855 int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
856 - struct inode *new_dir, struct dentry *new_dentry)
857 + struct inode *new_dir, struct dentry *new_dentry)
860 struct inode *target;
861 @@ -1811,7 +1987,7 @@
864 int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
865 - struct inode *new_dir, struct dentry *new_dentry)
866 + struct inode *new_dir, struct dentry *new_dentry)
870 @@ -1902,9 +2078,18 @@
871 if (newnd.last_type != LAST_NORM)
874 + if (old_dir->d_inode->i_op->rename_raw) {
876 + error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
878 + /* the file system wants to use normal vfs path now */
879 + if (error != -EOPNOTSUPP)
883 double_lock(new_dir, old_dir);
885 - old_dentry = lookup_hash(&oldnd.last, old_dir);
886 + old_dentry = lookup_hash_it(&oldnd.last, old_dir, NULL);
887 error = PTR_ERR(old_dentry);
888 if (IS_ERR(old_dentry))
890 @@ -1920,16 +2105,16 @@
891 if (newnd.last.name[newnd.last.len])
894 - new_dentry = lookup_hash(&newnd.last, new_dir);
895 + new_dentry = lookup_hash_it(&newnd.last, new_dir, NULL);
896 error = PTR_ERR(new_dentry);
897 if (IS_ERR(new_dentry))
902 error = vfs_rename(old_dir->d_inode, old_dentry,
903 new_dir->d_inode, new_dentry);
909 @@ -1980,20 +2165,26 @@
913 -__vfs_follow_link(struct nameidata *nd, const char *link)
914 +__vfs_follow_link(struct nameidata *nd, const char *link,
915 + struct lookup_intent *it)
924 + else if (it != nd->intent)
925 + printk("it != nd->intent: tell phil@clusterfs.com\n");
929 if (!walk_init_root(link, nd))
930 /* weird __emul_prefix() stuff did it */
933 - res = link_path_walk(link, nd);
934 + res = link_path_walk_it(link, nd, it);
936 if (current->link_count || res || nd->last_type!=LAST_NORM)
938 @@ -2015,7 +2206,13 @@
940 int vfs_follow_link(struct nameidata *nd, const char *link)
942 - return __vfs_follow_link(nd, link);
943 + return __vfs_follow_link(nd, link, NULL);
946 +int vfs_follow_link_it(struct nameidata *nd, const char *link,
947 + struct lookup_intent *it)
949 + return __vfs_follow_link(nd, link, it);
952 /* get the link contents into pagecache */
953 @@ -2057,7 +2254,7 @@
955 struct page *page = NULL;
956 char *s = page_getlink(dentry, &page);
957 - int res = __vfs_follow_link(nd, s);
958 + int res = __vfs_follow_link(nd, s, NULL);
961 page_cache_release(page);
962 Index: linux-2.4.19.SuSE/fs/open.c
963 ===================================================================
964 --- linux-2.4.19.SuSE.orig/fs/open.c Mon Jan 27 05:08:00 2003
965 +++ linux-2.4.19.SuSE/fs/open.c Sat Nov 15 17:43:27 2003
967 #include <asm/uaccess.h>
969 #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
970 +extern int path_walk_it(const char *name, struct nameidata *nd,
971 + struct lookup_intent *it);
973 int vfs_statfs(struct super_block *sb, struct statfs *buf)
976 write_unlock(&files->file_lock);
979 -int do_truncate(struct dentry *dentry, loff_t length)
980 +int do_truncate(struct dentry *dentry, loff_t length, int called_from_open)
982 struct inode *inode = dentry->d_inode;
983 + struct inode_operations *op = dentry->d_inode->i_op;
985 struct iattr newattrs;
989 newattrs.ia_size = length;
990 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
991 - error = notify_change(dentry, &newattrs);
992 + if (called_from_open)
993 + newattrs.ia_valid |= ATTR_FROM_OPEN;
994 + if (op->setattr_raw) {
995 + newattrs.ia_valid |= ATTR_RAW;
996 + error = op->setattr_raw(inode, &newattrs);
998 + error = notify_change(dentry, &newattrs);
1002 @@ -118,12 +127,13 @@
1003 struct nameidata nd;
1004 struct inode * inode;
1006 + struct lookup_intent it = { .it_op = IT_GETATTR };
1009 if (length < 0) /* sorry, but loff_t says... */
1012 - error = user_path_walk(path, &nd);
1013 + error = user_path_walk_it(path, &nd, &it);
1016 inode = nd.dentry->d_inode;
1017 @@ -163,11 +173,13 @@
1018 error = locks_verify_truncate(inode, NULL, length);
1021 - error = do_truncate(nd.dentry, length);
1022 + intent_release(&it);
1023 + error = do_truncate(nd.dentry, length, 0);
1025 put_write_access(inode);
1028 + intent_release(&it);
1034 error = locks_verify_truncate(inode, file, length);
1036 - error = do_truncate(dentry, length);
1037 + error = do_truncate(dentry, length, 0);
1041 @@ -260,11 +272,13 @@
1042 struct inode * inode;
1043 struct iattr newattrs;
1045 - error = user_path_walk(filename, &nd);
1046 + error = user_path_walk_it(filename, &nd, NULL);
1049 inode = nd.dentry->d_inode;
1051 + /* this is safe without a Lustre lock because it only depends
1052 + on the super block */
1054 if (IS_RDONLY(inode))
1056 @@ -279,11 +293,25 @@
1059 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
1063 + if (inode->i_op->setattr_raw) {
1064 + struct inode_operations *op = nd.dentry->d_inode->i_op;
1066 + newattrs.ia_valid |= ATTR_RAW;
1067 + error = op->setattr_raw(inode, &newattrs);
1068 + /* the file system wants to use normal vfs path now */
1069 + if (error != -EOPNOTSUPP)
1070 + goto dput_and_out;
1075 if (current->fsuid != inode->i_uid &&
1076 (error = permission(inode,MAY_WRITE)) != 0)
1080 error = notify_change(nd.dentry, &newattrs);
1083 @@ -304,12 +332,14 @@
1084 struct inode * inode;
1085 struct iattr newattrs;
1087 - error = user_path_walk(filename, &nd);
1088 + error = user_path_walk_it(filename, &nd, NULL);
1092 inode = nd.dentry->d_inode;
1094 + /* this is safe without a Lustre lock because it only depends
1095 + on the super block */
1097 if (IS_RDONLY(inode))
1099 @@ -324,7 +354,20 @@
1100 newattrs.ia_atime = times[0].tv_sec;
1101 newattrs.ia_mtime = times[1].tv_sec;
1102 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
1106 + if (inode->i_op->setattr_raw) {
1107 + struct inode_operations *op = nd.dentry->d_inode->i_op;
1109 + newattrs.ia_valid |= ATTR_RAW;
1110 + error = op->setattr_raw(inode, &newattrs);
1111 + /* the file system wants to use normal vfs path now */
1112 + if (error != -EOPNOTSUPP)
1113 + goto dput_and_out;
1118 if (current->fsuid != inode->i_uid &&
1119 (error = permission(inode,MAY_WRITE)) != 0)
1122 int old_fsuid, old_fsgid;
1123 kernel_cap_t old_cap;
1125 + struct lookup_intent it = { .it_op = IT_GETATTR };
1127 if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
1129 @@ -364,13 +408,14 @@
1131 current->cap_effective = current->cap_permitted;
1133 - res = user_path_walk(filename, &nd);
1134 + res = user_path_walk_it(filename, &nd, &it);
1136 res = permission(nd.dentry->d_inode, mode);
1137 /* SuS v2 requires we report a read only fs too */
1138 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
1139 && !special_file(nd.dentry->d_inode->i_mode))
1141 + intent_release(&it);
1147 struct nameidata nd;
1149 + struct lookup_intent it = { .it_op = IT_GETATTR };
1151 name = getname(filename);
1152 error = PTR_ERR(name);
1156 if (path_init(name,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd))
1157 - error = path_walk(name, &nd);
1158 + error = path_walk_it(name, &nd, &it);
1163 set_fs_pwd(current->fs, nd.mnt, nd.dentry);
1166 + intent_release(&it);
1172 struct nameidata nd;
1174 + struct lookup_intent it = { .it_op = IT_GETATTR };
1176 name = getname(filename);
1177 error = PTR_ERR(name);
1180 path_init(name, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
1181 LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
1182 - error = path_walk(name, &nd);
1183 + error = path_walk_it(name, &nd, &it);
1187 @@ -471,39 +519,56 @@
1191 + intent_release(&it);
1197 -asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
1198 +int chmod_common(struct dentry *dentry, mode_t mode)
1200 - struct inode * inode;
1201 - struct dentry * dentry;
1202 - struct file * file;
1204 + struct inode *inode = dentry->d_inode;
1205 struct iattr newattrs;
1210 + if (IS_RDONLY(inode))
1213 - dentry = file->f_dentry;
1214 - inode = dentry->d_inode;
1215 + if (inode->i_op->setattr_raw) {
1216 + newattrs.ia_mode = mode;
1217 + newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1218 + newattrs.ia_valid |= ATTR_RAW;
1219 + err = inode->i_op->setattr_raw(inode, &newattrs);
1220 + /* the file system wants to use normal vfs path now */
1221 + if (err != -EOPNOTSUPP)
1226 - if (IS_RDONLY(inode))
1229 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1233 if (mode == (mode_t) -1)
1234 mode = inode->i_mode;
1235 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
1236 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1237 err = notify_change(dentry, &newattrs);
1244 +asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
1246 + struct file * file;
1253 + err = chmod_common(file->f_dentry, mode);
1258 @@ -512,30 +577,14 @@
1259 asmlinkage long sys_chmod(const char * filename, mode_t mode)
1261 struct nameidata nd;
1262 - struct inode * inode;
1264 - struct iattr newattrs;
1266 error = user_path_walk(filename, &nd);
1269 - inode = nd.dentry->d_inode;
1272 - if (IS_RDONLY(inode))
1273 - goto dput_and_out;
1276 - if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1277 - goto dput_and_out;
1278 + error = chmod_common(nd.dentry, mode);
1280 - if (mode == (mode_t) -1)
1281 - mode = inode->i_mode;
1282 - newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
1283 - newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1284 - error = notify_change(nd.dentry, &newattrs);
1290 @@ -555,6 +604,20 @@
1292 if (IS_RDONLY(inode))
1295 + if (inode->i_op->setattr_raw) {
1296 + struct inode_operations *op = dentry->d_inode->i_op;
1298 + newattrs.ia_uid = user;
1299 + newattrs.ia_gid = group;
1300 + newattrs.ia_valid = ATTR_UID | ATTR_GID | ATTR_CTIME;
1301 + newattrs.ia_valid |= ATTR_RAW;
1302 + error = op->setattr_raw(inode, &newattrs);
1303 + /* the file system wants to use normal vfs path now */
1304 + if (error != -EOPNOTSUPP)
1309 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1313 int namei_flags, error;
1314 struct nameidata nd;
1315 + struct lookup_intent it = { .it_op = IT_OPEN };
1317 namei_flags = flags;
1318 if ((namei_flags+1) & O_ACCMODE)
1319 @@ -666,14 +730,15 @@
1320 if (namei_flags & O_TRUNC)
1323 - error = open_namei(filename, namei_flags, mode, &nd);
1325 - return dentry_open(nd.dentry, nd.mnt, flags);
1326 + error = open_namei_it(filename, namei_flags, mode, &nd, &it);
1328 + return ERR_PTR(error);
1330 - return ERR_PTR(error);
1331 + return dentry_open_it(nd.dentry, nd.mnt, flags, &it);
1334 -struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1335 +struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1336 + int flags, struct lookup_intent *it)
1339 struct inode *inode;
1343 if (f->f_op && f->f_op->open) {
1345 error = f->f_op->open(inode,f);
1351 !inode->i_mapping->a_ops->direct_IO))
1354 + intent_release(it);
1358 @@ -736,11 +804,17 @@
1362 + intent_release(it);
1365 return ERR_PTR(error);
1368 +struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1370 + return dentry_open_it(dentry, mnt, flags, NULL);
1374 * Find an empty file descriptor entry, and mark it busy.
1376 Index: linux-2.4.19.SuSE/fs/stat.c
1377 ===================================================================
1378 --- linux-2.4.19.SuSE.orig/fs/stat.c Mon Jan 27 05:08:00 2003
1379 +++ linux-2.4.19.SuSE/fs/stat.c Sat Nov 15 17:29:03 2003
1381 * Revalidate the inode. This is required for proper NFS attribute caching.
1383 static __inline__ int
1384 -do_revalidate(struct dentry *dentry)
1385 +do_revalidate(struct dentry *dentry, struct lookup_intent *it)
1387 struct inode * inode = dentry->d_inode;
1388 - if (inode->i_op && inode->i_op->revalidate)
1391 + if (inode->i_op && inode->i_op->revalidate_it)
1392 + return inode->i_op->revalidate_it(dentry, it);
1393 + else if (inode->i_op && inode->i_op->revalidate)
1394 return inode->i_op->revalidate(dentry);
1397 @@ -141,13 +145,15 @@
1398 asmlinkage long sys_stat(char * filename, struct __old_kernel_stat * statbuf)
1400 struct nameidata nd;
1401 + struct lookup_intent it = { .it_op = IT_GETATTR };
1404 - error = user_path_walk(filename, &nd);
1405 + error = user_path_walk_it(filename, &nd, &it);
1407 - error = do_revalidate(nd.dentry);
1408 + error = do_revalidate(nd.dentry, &it);
1410 error = cp_old_stat(nd.dentry->d_inode, statbuf);
1411 + intent_release(&it);
1415 @@ -157,13 +163,15 @@
1416 asmlinkage long sys_newstat(char * filename, struct stat * statbuf)
1418 struct nameidata nd;
1419 + struct lookup_intent it = { .it_op = IT_GETATTR };
1422 - error = user_path_walk(filename, &nd);
1423 + error = user_path_walk_it(filename, &nd, &it);
1425 - error = do_revalidate(nd.dentry);
1426 + error = do_revalidate(nd.dentry, &it);
1428 error = cp_new_stat(nd.dentry->d_inode, statbuf);
1429 + intent_release(&it);
1433 @@ -178,13 +186,15 @@
1434 asmlinkage long sys_lstat(char * filename, struct __old_kernel_stat * statbuf)
1436 struct nameidata nd;
1437 + struct lookup_intent it = { .it_op = IT_GETATTR };
1440 - error = user_path_walk_link(filename, &nd);
1441 + error = user_path_walk_link_it(filename, &nd, &it);
1443 - error = do_revalidate(nd.dentry);
1444 + error = do_revalidate(nd.dentry, &it);
1446 error = cp_old_stat(nd.dentry->d_inode, statbuf);
1447 + intent_release(&it);
1451 @@ -195,13 +205,15 @@
1452 asmlinkage long sys_newlstat(char * filename, struct stat * statbuf)
1454 struct nameidata nd;
1455 + struct lookup_intent it = { .it_op = IT_GETATTR };
1458 - error = user_path_walk_link(filename, &nd);
1459 + error = user_path_walk_link_it(filename, &nd, &it);
1461 - error = do_revalidate(nd.dentry);
1462 + error = do_revalidate(nd.dentry, &it);
1464 error = cp_new_stat(nd.dentry->d_inode, statbuf);
1465 + intent_release(&it);
1471 struct dentry * dentry = f->f_dentry;
1473 - err = do_revalidate(dentry);
1474 + err = do_revalidate(dentry, NULL);
1476 err = cp_old_stat(dentry->d_inode, statbuf);
1480 struct dentry * dentry = f->f_dentry;
1482 - err = do_revalidate(dentry);
1483 + err = do_revalidate(dentry, NULL);
1485 err = cp_new_stat(dentry->d_inode, statbuf);
1490 if (inode->i_op && inode->i_op->readlink &&
1491 - !(error = do_revalidate(nd.dentry))) {
1492 + !(error = do_revalidate(nd.dentry, NULL))) {
1493 UPDATE_ATIME(inode);
1494 error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
1496 @@ -339,12 +351,14 @@
1498 struct nameidata nd;
1500 + struct lookup_intent it = { .it_op = IT_GETATTR };
1502 - error = user_path_walk(filename, &nd);
1503 + error = user_path_walk_it(filename, &nd, &it);
1505 - error = do_revalidate(nd.dentry);
1506 + error = do_revalidate(nd.dentry, &it);
1508 error = cp_new_stat64(nd.dentry->d_inode, statbuf);
1509 + intent_release(&it);
1513 @@ -354,12 +368,14 @@
1515 struct nameidata nd;
1517 + struct lookup_intent it = { .it_op = IT_GETATTR };
1519 - error = user_path_walk_link(filename, &nd);
1520 + error = user_path_walk_link_it(filename, &nd, &it);
1522 - error = do_revalidate(nd.dentry);
1523 + error = do_revalidate(nd.dentry, &it);
1525 error = cp_new_stat64(nd.dentry->d_inode, statbuf);
1526 + intent_release(&it);
1532 struct dentry * dentry = f->f_dentry;
1534 - err = do_revalidate(dentry);
1535 + err = do_revalidate(dentry, NULL);
1537 err = cp_new_stat64(dentry->d_inode, statbuf);
1539 Index: linux-2.4.19.SuSE/include/linux/dcache.h
1540 ===================================================================
1541 --- linux-2.4.19.SuSE.orig/include/linux/dcache.h Mon Jan 27 05:13:15 2003
1542 +++ linux-2.4.19.SuSE/include/linux/dcache.h Sat Nov 15 17:35:46 2003
1545 #include <asm/atomic.h>
1546 #include <linux/mount.h>
1547 +#include <linux/string.h>
1549 +#define IT_OPEN 0x0001
1550 +#define IT_CREAT 0x0002
1551 +#define IT_READDIR 0x0004
1552 +#define IT_GETATTR 0x0008
1553 +#define IT_LOOKUP 0x0010
1554 +#define IT_UNLINK 0x0020
1555 +#define IT_GETXATTR 0x0040
1556 +#define IT_EXEC 0x0080
1557 +#define IT_PIN 0x0100
1559 +#define IT_FL_LOCKED 0x0001
1560 +#define IT_FL_FOLLOWED 0x0002 /* set by vfs_follow_link */
1562 +#define INTENT_MAGIC 0x19620323
1565 +struct lustre_intent_data {
1566 + int it_disposition;
1568 + __u64 it_lock_handle;
1573 +struct lookup_intent {
1575 + void (*it_op_release)(struct lookup_intent *);
1578 + int it_create_mode;
1580 + struct lustre_intent_data lustre;
1584 +static inline void intent_init(struct lookup_intent *it, int op, int flags)
1586 + memset(it, 0, sizeof(*it));
1587 + it->it_magic = INTENT_MAGIC;
1589 + it->it_flags = flags;
1594 * linux/include/linux/dcache.h
1596 int (*d_delete)(struct dentry *);
1597 void (*d_release)(struct dentry *);
1598 void (*d_iput)(struct dentry *, struct inode *);
1599 + int (*d_revalidate_it)(struct dentry *, int, struct lookup_intent *);
1600 + void (*d_pin)(struct dentry *, struct vfsmount * , int);
1601 + void (*d_unpin)(struct dentry *, struct vfsmount *, int);
1604 +#define PIN(de,mnt,flag) if (de && de->d_op && de->d_op->d_pin) \
1605 + de->d_op->d_pin(de, mnt, flag);
1606 +#define UNPIN(de,mnt,flag) if (de && de->d_op && de->d_op->d_unpin) \
1607 + de->d_op->d_unpin(de, mnt, flag);
1610 +/* defined in fs/namei.c */
1611 +extern void intent_release(struct lookup_intent *it);
1612 +/* defined in fs/dcache.c */
1613 +extern void __d_rehash(struct dentry * entry, int lock);
1615 /* the dentry parameter passed to d_hash and d_compare is the parent
1616 * directory of the entries to be compared. It is used in case these
1617 * functions need any directory specific information for determining
1619 * s_nfsd_free_path semaphore will be down
1621 #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
1622 +#define DCACHE_LUSTRE_INVALID 0x0010 /* Lustre invalidated */
1624 extern spinlock_t dcache_lock;
1626 Index: linux-2.4.19.SuSE/include/linux/fs.h
1627 ===================================================================
1628 --- linux-2.4.19.SuSE.orig/include/linux/fs.h Sat Nov 15 17:25:06 2003
1629 +++ linux-2.4.19.SuSE/include/linux/fs.h Sat Nov 15 17:29:03 2003
1632 #define FMODE_READ 1
1633 #define FMODE_WRITE 2
1634 +#define FMODE_EXEC 4
1639 #define ATTR_MTIME_SET 256
1640 #define ATTR_FORCE 512 /* Not a change, but a change it */
1641 #define ATTR_ATTR_FLAG 1024
1642 +#define ATTR_RAW 0x0800 /* file system, not vfs will massage attrs */
1643 +#define ATTR_FROM_OPEN 0x1000 /* called from open path, ie O_TRUNC */
1644 +#define ATTR_CTIME_SET 0x2000
1647 * This is the Inode Attributes structure, used for notify_change(). It
1649 struct pipe_inode_info *i_pipe;
1650 struct block_device *i_bdev;
1651 struct char_device *i_cdev;
1652 + void *i_filterdata;
1654 unsigned long i_dnotify_mask; /* Directory notify events */
1655 struct dnotify_struct *i_dnotify; /* for directory notifications */
1658 /* needed for tty driver, and maybe others */
1660 + struct lookup_intent *f_it;
1662 /* preallocated helper kiobuf to speedup O_DIRECT */
1663 struct kiobuf *f_iobuf;
1668 + struct lookup_intent *intent;
1671 #define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */
1673 extern int __vfs_rmdir(struct inode *, struct dentry *);
1674 extern int vfs_rmdir(struct inode *, struct dentry *);
1675 extern int vfs_unlink(struct inode *, struct dentry *);
1676 -extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
1677 +int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1678 + struct inode *new_dir, struct dentry *new_dentry);
1682 @@ -1020,21 +1028,32 @@
1684 struct inode_operations {
1685 int (*create) (struct inode *,struct dentry *,int);
1686 + int (*create_it) (struct inode *,struct dentry *,int, struct lookup_intent *);
1687 struct dentry * (*lookup) (struct inode *,struct dentry *);
1688 + struct dentry * (*lookup_it) (struct inode *,struct dentry *, struct lookup_intent *, int flags);
1689 int (*link) (struct dentry *,struct inode *,struct dentry *);
1690 + int (*link_raw) (struct nameidata *,struct nameidata *);
1691 int (*unlink) (struct inode *,struct dentry *);
1692 + int (*unlink_raw) (struct nameidata *);
1693 int (*symlink) (struct inode *,struct dentry *,const char *);
1694 + int (*symlink_raw) (struct nameidata *,const char *);
1695 int (*mkdir) (struct inode *,struct dentry *,int);
1696 + int (*mkdir_raw) (struct nameidata *,int);
1697 int (*rmdir) (struct inode *,struct dentry *);
1698 + int (*rmdir_raw) (struct nameidata *);
1699 int (*mknod) (struct inode *,struct dentry *,int,int);
1700 + int (*mknod_raw) (struct nameidata *,int,dev_t);
1701 int (*rename) (struct inode *, struct dentry *,
1702 struct inode *, struct dentry *);
1703 + int (*rename_raw) (struct nameidata *, struct nameidata *);
1704 int (*readlink) (struct dentry *, char *,int);
1705 int (*follow_link) (struct dentry *, struct nameidata *);
1706 void (*truncate) (struct inode *);
1707 int (*permission) (struct inode *, int);
1708 int (*revalidate) (struct dentry *);
1709 + int (*revalidate_it) (struct dentry *, struct lookup_intent *);
1710 int (*setattr) (struct dentry *, struct iattr *);
1711 + int (*setattr_raw) (struct inode *, struct iattr *);
1712 int (*getattr) (struct dentry *, struct iattr *);
1713 int (*setxattr) (struct dentry *, const char *, const void *, size_t, int);
1714 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
1715 @@ -1244,10 +1263,14 @@
1717 asmlinkage long sys_open(const char *, int, int);
1718 asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
1719 -extern int do_truncate(struct dentry *, loff_t start);
1720 +extern int do_truncate(struct dentry *, loff_t start, int called_from_open);
1722 extern struct file *filp_open(const char *, int, int);
1723 extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
1724 +extern int open_namei_it(const char *filename, int namei_flags, int mode,
1725 + struct nameidata *nd, struct lookup_intent *it);
1726 +extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1727 + int flags, struct lookup_intent *it);
1728 extern int filp_close(struct file *, fl_owner_t id);
1729 extern char * getname(const char *);
1731 @@ -1515,6 +1538,7 @@
1732 extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
1734 extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
1735 +extern int FASTCALL(__user_walk_it(const char *, unsigned, struct nameidata *, struct lookup_intent *it));
1736 extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
1737 extern int FASTCALL(path_walk(const char *, struct nameidata *));
1738 extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
1739 @@ -1526,6 +1550,8 @@
1740 extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
1741 #define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
1742 #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
1743 +#define user_path_walk_it(name,nd,it) __user_walk_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd, it)
1744 +#define user_path_walk_link_it(name,nd,it) __user_walk_it(name, LOOKUP_POSITIVE, nd, it)
1746 extern void iput(struct inode *);
1747 extern void force_delete(struct inode *);
1748 @@ -1646,6 +1672,8 @@
1750 extern int vfs_readlink(struct dentry *, char *, int, const char *);
1751 extern int vfs_follow_link(struct nameidata *, const char *);
1752 +extern int vfs_follow_link_it(struct nameidata *, const char *,
1753 + struct lookup_intent *it);
1754 extern int page_readlink(struct dentry *, char *, int);
1755 extern int page_follow_link(struct dentry *, struct nameidata *);
1756 extern struct inode_operations page_symlink_inode_operations;
1757 Index: linux-2.4.19.SuSE/include/linux/fs_struct.h
1758 ===================================================================
1759 --- linux-2.4.19.SuSE.orig/include/linux/fs_struct.h Fri Jul 13 15:10:44 2001
1760 +++ linux-2.4.19.SuSE/include/linux/fs_struct.h Sat Nov 15 17:29:03 2003
1762 write_lock(&fs->lock);
1763 old_root = fs->root;
1764 old_rootmnt = fs->rootmnt;
1765 + PIN(dentry, mnt, 1);
1766 fs->rootmnt = mntget(mnt);
1767 fs->root = dget(dentry);
1768 write_unlock(&fs->lock);
1770 + UNPIN(old_root, old_rootmnt, 1);
1772 mntput(old_rootmnt);
1775 write_lock(&fs->lock);
1777 old_pwdmnt = fs->pwdmnt;
1778 + PIN(dentry, mnt, 0);
1779 fs->pwdmnt = mntget(mnt);
1780 fs->pwd = dget(dentry);
1781 write_unlock(&fs->lock);
1783 + UNPIN(old_pwd, old_pwdmnt, 0);
1787 Index: linux-2.4.19.SuSE/kernel/ksyms.c
1788 ===================================================================
1789 --- linux-2.4.19.SuSE.orig/kernel/ksyms.c Sat Nov 15 17:24:46 2003
1790 +++ linux-2.4.19.SuSE/kernel/ksyms.c Sat Nov 15 17:29:03 2003
1792 EXPORT_SYMBOL(set_page_dirty);
1793 EXPORT_SYMBOL(vfs_readlink);
1794 EXPORT_SYMBOL(vfs_follow_link);
1795 +EXPORT_SYMBOL(vfs_follow_link_it);
1796 EXPORT_SYMBOL(page_readlink);
1797 EXPORT_SYMBOL(page_follow_link);
1798 EXPORT_SYMBOL(page_symlink_inode_operations);
1799 Index: linux-2.4.19.SuSE/kernel/fork.c
1800 ===================================================================
1801 --- linux-2.4.19.SuSE.orig/kernel/fork.c Mon Jan 27 05:08:56 2003
1802 +++ linux-2.4.19.SuSE/kernel/fork.c Sat Nov 15 17:29:03 2003
1803 @@ -454,10 +454,13 @@
1804 fs->umask = old->umask;
1805 read_lock(&old->lock);
1806 fs->rootmnt = mntget(old->rootmnt);
1807 + PIN(old->pwd, old->pwdmnt, 0);
1808 + PIN(old->root, old->rootmnt, 1);
1809 fs->root = dget(old->root);
1810 fs->pwdmnt = mntget(old->pwdmnt);
1811 fs->pwd = dget(old->pwd);
1813 + PIN(old->altroot, old->altrootmnt, 1);
1814 fs->altrootmnt = mntget(old->altrootmnt);
1815 fs->altroot = dget(old->altroot);
1817 Index: linux-2.4.19.SuSE/kernel/exit.c
1818 ===================================================================
1819 --- linux-2.4.19.SuSE.orig/kernel/exit.c Mon Jan 27 05:08:16 2003
1820 +++ linux-2.4.19.SuSE/kernel/exit.c Sat Nov 15 17:29:03 2003
1821 @@ -288,11 +288,14 @@
1823 /* No need to hold fs->lock if we are killing it */
1824 if (atomic_dec_and_test(&fs->count)) {
1825 + UNPIN(fs->pwd, fs->pwdmnt, 0);
1826 + UNPIN(fs->root, fs->rootmnt, 1);
1828 mntput(fs->rootmnt);
1832 + UNPIN(fs->altroot, fs->altrootmnt, 1);
1834 mntput(fs->altrootmnt);