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-pre1/fs/dcache.c
16 ===================================================================
17 --- linux-2.4.19-pre1.orig/fs/dcache.c 2003-11-21 02:41:00.000000000 +0300
18 +++ linux-2.4.19-pre1/fs/dcache.c 2003-11-21 02:51:38.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.19-pre1/fs/exec.c
57 ===================================================================
58 --- linux-2.4.19-pre1.orig/fs/exec.c 2003-11-21 02:41:00.000000000 +0300
59 +++ linux-2.4.19-pre1/fs/exec.c 2003-11-21 02:51:38.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 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-pre1/fs/namei.c
123 ===================================================================
124 --- linux-2.4.19-pre1.orig/fs/namei.c 2003-11-21 02:41:00.000000000 +0300
125 +++ linux-2.4.19-pre1/fs/namei.c 2003-11-21 02:52:01.000000000 +0300
127 * XEmacs seems to be relying on it...
130 +void intent_release(struct lookup_intent *it)
132 + if (it && it->it_op_release)
133 + it->it_op_release(it);
137 /* In order to reduce some races, while at the same time doing additional
138 * checking and hopefully speeding things up, we copy filenames to the
139 * kernel data space before using them..
140 @@ -260,10 +267,19 @@
141 * Internal lookup() using the new generic dcache.
144 -static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name, int flags)
145 +static struct dentry *cached_lookup(struct dentry *parent, struct qstr *name,
146 + int flags, struct lookup_intent *it)
148 struct dentry * dentry = d_lookup(parent, name);
150 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
151 + if (!dentry->d_op->d_revalidate_it(dentry, flags, NULL, it) &&
152 + !d_invalidate(dentry)) {
158 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
159 if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) {
161 @@ -281,11 +297,15 @@
162 * make sure that nobody added the entry to the dcache in the meantime..
165 -static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, int flags)
166 +static struct dentry *real_lookup(struct dentry *parent, struct qstr *name,
167 + int flags, struct lookup_intent *it)
169 struct dentry * result;
170 struct inode *dir = parent->d_inode;
177 * First re-do the cached lookup just in case it was created
179 result = ERR_PTR(-ENOMEM);
182 + if (dir->i_op->lookup_it)
183 + result = dir->i_op->lookup_it(dir, dentry, NULL, it, flags);
185 result = dir->i_op->lookup(dir, dentry);
190 result = ERR_PTR(-ENOENT);
192 + } else if (result->d_op && result->d_op->d_revalidate_it) {
193 + if (!result->d_op->d_revalidate_it(result, flags, NULL, it) &&
194 + !d_invalidate(result)) {
197 + result = ERR_PTR(-ESTALE);
198 + if (!IS_ERR(result))
205 * Without that kind of total limit, nasty chains of consecutive
206 * symlinks can cause almost arbitrarily long lookups.
208 -static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
209 +static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd,
210 + struct lookup_intent *it)
213 if (current->link_count >= 5)
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;
244 inode = nd->dentry->d_inode;
245 if (current->link_count)
249 /* This does the actual lookups.. */
250 - dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
251 + dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE, NULL);
253 - dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE);
254 + dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE,
256 err = PTR_ERR(dentry);
262 if (inode->i_op->follow_link) {
263 - err = do_follow_link(dentry, nd);
264 + err = do_follow_link(dentry, nd, NULL);
272 - if (!inode->i_op->lookup)
273 + if (!inode->i_op->lookup && !inode->i_op->lookup_it)
276 /* here ends the main loop */
277 @@ -574,16 +611,16 @@
278 inode = nd->dentry->d_inode;
284 if (nd->dentry->d_op && nd->dentry->d_op->d_hash) {
285 err = nd->dentry->d_op->d_hash(nd->dentry, &this);
289 - dentry = cached_lookup(nd->dentry, &this, 0);
290 + dentry = cached_lookup(nd->dentry, &this, 0, it);
292 - dentry = real_lookup(nd->dentry, &this, 0);
293 + dentry = real_lookup(nd->dentry, &this, 0, it);
294 err = PTR_ERR(dentry);
298 inode = dentry->d_inode;
299 if ((lookup_flags & LOOKUP_FOLLOW)
300 && inode && inode->i_op && inode->i_op->follow_link) {
301 - err = do_follow_link(dentry, nd);
302 + err = do_follow_link(dentry, nd, it);
308 if (lookup_flags & LOOKUP_DIRECTORY) {
310 - if (!inode->i_op || !inode->i_op->lookup)
311 + if (!inode->i_op ||
312 + (!inode->i_op->lookup && !inode->i_op->lookup_it))
316 @@ -625,21 +663,68 @@
317 nd->last_type = LAST_DOT;
318 else if (this.len == 2 && this.name[1] == '.')
319 nd->last_type = LAST_DOTDOT;
322 + * We bypassed the ordinary revalidation routines.
323 + * Check the cached dentry for staleness.
325 + dentry = nd->dentry;
326 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
328 + if (!dentry->d_op->d_revalidate_it(dentry, 0, NULL, it)) {
329 + struct dentry *new;
330 + err = permission(dentry->d_parent->d_inode,
334 + new = real_lookup(dentry->d_parent,
335 + &dentry->d_name, 0, it);
337 + err = PTR_ERR(new);
340 + d_invalidate(dentry);
344 + if (!nd->dentry->d_inode)
347 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
349 + if (!dentry->d_op->d_revalidate(dentry, 0)) {
350 + d_invalidate(dentry);
361 + intent_release(it);
367 +int link_path_walk(const char * name, struct nameidata *nd)
369 + return link_path_walk_it(name, nd, NULL);
372 +int path_walk_it(const char * name, struct nameidata *nd, struct lookup_intent *it)
374 + current->total_link_count = 0;
375 + return link_path_walk_it(name, nd, it);
378 int path_walk(const char * name, struct nameidata *nd)
380 current->total_link_count = 0;
381 - return link_path_walk(name, nd);
382 + return link_path_walk_it(name, nd, NULL);
388 nd->last_type = LAST_ROOT; /* if there are only slashes... */
392 return walk_init_root(name,nd);
393 read_lock(¤t->fs->lock);
395 * needs parent already locked. Doesn't follow mounts.
398 -struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
399 +struct dentry * lookup_hash_it(struct qstr *name, struct dentry * base,
400 + struct lookup_intent *it)
402 struct dentry * dentry;
404 @@ -765,13 +850,16 @@
408 - dentry = cached_lookup(base, name, 0);
409 + dentry = cached_lookup(base, name, 0, it);
411 struct dentry *new = d_alloc(base, name);
412 dentry = ERR_PTR(-ENOMEM);
416 + if (inode->i_op->lookup_it)
417 + dentry = inode->i_op->lookup_it(inode, new, NULL, it, 0);
419 dentry = inode->i_op->lookup(inode, new);
426 +struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
428 + return lookup_hash_it(name, base, NULL);
433 struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
437 this.hash = end_name_hash(hash);
439 - return lookup_hash(&this, base);
440 + return lookup_hash_it(&this, base, NULL);
442 return ERR_PTR(-EACCES);
448 +int __user_walk_it(const char *name, unsigned flags, struct nameidata *nd,
449 + struct lookup_intent *it)
454 + tmp = getname(name);
455 + err = PTR_ERR(tmp);
456 + if (!IS_ERR(tmp)) {
458 + if (path_init(tmp, flags, nd))
459 + err = path_walk_it(tmp, nd, it);
466 * It's inline, so penalty for filesystems that don't use sticky bit is
472 -int vfs_create(struct inode *dir, struct dentry *dentry, int mode)
473 +static int vfs_create_it(struct inode *dir, struct dentry *dentry, int mode,
474 + struct lookup_intent *it)
478 @@ -942,12 +1054,15 @@
481 error = -EACCES; /* shouldn't it be ENOSYS? */
482 - if (!dir->i_op || !dir->i_op->create)
483 + if (!dir->i_op || (!dir->i_op->create && !dir->i_op->create_it))
488 - error = dir->i_op->create(dir, dentry, mode);
489 + if (dir->i_op->create_it)
490 + error = dir->i_op->create_it(dir, dentry, mode, it);
492 + error = dir->i_op->create(dir, dentry, mode);
496 @@ -956,6 +1071,11 @@
500 +int vfs_create(struct inode *dir, struct dentry *dentry, int mode)
502 + return vfs_create_it(dir, dentry, mode, NULL);
509 * for symlinks (where the permissions are checked later).
512 -int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
513 +int open_namei_it(const char *pathname, int flag, int mode,
514 + struct nameidata *nd, struct lookup_intent *it)
516 int acc_mode, error = 0;
518 @@ -980,12 +1101,14 @@
520 acc_mode = ACC_MODE(flag);
523 + it->it_flags = flag;
525 * The simplest case - just a plain lookup.
527 if (!(flag & O_CREAT)) {
528 if (path_init(pathname, lookup_flags(flag), nd))
529 - error = path_walk(pathname, nd);
530 + error = path_walk_it(pathname, nd, it);
534 @@ -995,6 +1118,10 @@
536 * Create - we need to know the parent.
539 + it->it_create_mode = mode;
540 + it->it_op |= IT_CREAT;
542 if (path_init(pathname, LOOKUP_PARENT, nd))
543 error = path_walk(pathname, nd);
545 @@ -1011,7 +1138,7 @@
548 down(&dir->d_inode->i_sem);
549 - dentry = lookup_hash(&nd->last, nd->dentry);
550 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
553 error = PTR_ERR(dentry);
554 @@ -1020,10 +1147,11 @@
558 + it->it_create_mode = mode;
559 /* Negative dentry, just create the file */
560 if (!dentry->d_inode) {
561 - error = vfs_create(dir->d_inode, dentry,
562 - mode & ~current->fs->umask);
563 + error = vfs_create_it(dir->d_inode, dentry,
564 + mode & ~current->fs->umask, it);
565 up(&dir->d_inode->i_sem);
568 @@ -1127,7 +1255,7 @@
572 - error = do_truncate(dentry, 0);
573 + error = do_truncate(dentry, 0, 1);
575 put_write_access(inode);
577 @@ -1139,8 +1267,10 @@
581 + intent_release(it);
584 + intent_release(it);
588 @@ -1159,7 +1289,10 @@
589 * are done. Procfs-like symlinks just set LAST_BIND.
591 UPDATE_ATIME(dentry->d_inode);
593 error = dentry->d_inode->i_op->follow_link(dentry, nd);
595 + intent_release(it);
599 @@ -1181,13 +1314,20 @@
602 down(&dir->d_inode->i_sem);
603 - dentry = lookup_hash(&nd->last, nd->dentry);
604 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
605 putname(nd->last.name);
609 +int open_namei(const char *pathname, int flag, int mode, struct nameidata *nd)
611 + return open_namei_it(pathname, flag, mode, nd, NULL);
616 -static struct dentry *lookup_create(struct nameidata *nd, int is_dir)
617 +struct dentry *lookup_create(struct nameidata *nd, int is_dir,
618 + struct lookup_intent *it)
620 struct dentry *dentry;
622 @@ -1195,7 +1335,7 @@
623 dentry = ERR_PTR(-EEXIST);
624 if (nd->last_type != LAST_NORM)
626 - dentry = lookup_hash(&nd->last, nd->dentry);
627 + dentry = lookup_hash_it(&nd->last, nd->dentry, it);
630 if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
631 @@ -1252,7 +1392,20 @@
632 error = path_walk(tmp, &nd);
635 - dentry = lookup_create(&nd, 0);
637 + if (nd.last_type != LAST_NORM) {
641 + if (nd.dentry->d_inode->i_op->mknod_raw) {
642 + struct inode_operations *op = nd.dentry->d_inode->i_op;
643 + error = op->mknod_raw(&nd, mode, dev);
644 + /* the file system wants to use normal vfs path now */
645 + if (error != -EOPNOTSUPP)
649 + dentry = lookup_create(&nd, 0, NULL);
650 error = PTR_ERR(dentry);
652 mode &= ~current->fs->umask;
653 @@ -1273,6 +1422,7 @@
656 up(&nd.dentry->d_inode->i_sem);
661 @@ -1321,7 +1471,18 @@
662 error = path_walk(tmp, &nd);
665 - dentry = lookup_create(&nd, 1);
666 + if (nd.last_type != LAST_NORM) {
670 + if (nd.dentry->d_inode->i_op->mkdir_raw) {
671 + struct inode_operations *op = nd.dentry->d_inode->i_op;
672 + error = op->mkdir_raw(&nd, mode);
673 + /* the file system wants to use normal vfs path now */
674 + if (error != -EOPNOTSUPP)
677 + dentry = lookup_create(&nd, 1, NULL);
678 error = PTR_ERR(dentry);
679 if (!IS_ERR(dentry)) {
680 error = vfs_mkdir(nd.dentry->d_inode, dentry,
681 @@ -1329,6 +1486,7 @@
684 up(&nd.dentry->d_inode->i_sem);
689 @@ -1428,8 +1586,16 @@
693 + if (nd.dentry->d_inode->i_op->rmdir_raw) {
694 + struct inode_operations *op = nd.dentry->d_inode->i_op;
696 + error = op->rmdir_raw(&nd);
697 + /* the file system wants to use normal vfs path now */
698 + if (error != -EOPNOTSUPP)
701 down(&nd.dentry->d_inode->i_sem);
702 - dentry = lookup_hash(&nd.last, nd.dentry);
703 + dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
704 error = PTR_ERR(dentry);
705 if (!IS_ERR(dentry)) {
706 error = vfs_rmdir(nd.dentry->d_inode, dentry);
707 @@ -1488,8 +1654,15 @@
709 if (nd.last_type != LAST_NORM)
711 + if (nd.dentry->d_inode->i_op->unlink_raw) {
712 + struct inode_operations *op = nd.dentry->d_inode->i_op;
713 + error = op->unlink_raw(&nd);
714 + /* the file system wants to use normal vfs path now */
715 + if (error != -EOPNOTSUPP)
718 down(&nd.dentry->d_inode->i_sem);
719 - dentry = lookup_hash(&nd.last, nd.dentry);
720 + dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
721 error = PTR_ERR(dentry);
722 if (!IS_ERR(dentry)) {
723 /* Why not before? Because we want correct error value */
724 @@ -1557,15 +1730,27 @@
725 error = path_walk(to, &nd);
728 - dentry = lookup_create(&nd, 0);
729 + if (nd.last_type != LAST_NORM) {
733 + if (nd.dentry->d_inode->i_op->symlink_raw) {
734 + struct inode_operations *op = nd.dentry->d_inode->i_op;
735 + error = op->symlink_raw(&nd, from);
736 + /* the file system wants to use normal vfs path now */
737 + if (error != -EOPNOTSUPP)
740 + dentry = lookup_create(&nd, 0, NULL);
741 error = PTR_ERR(dentry);
742 if (!IS_ERR(dentry)) {
743 error = vfs_symlink(nd.dentry->d_inode, dentry, from);
746 up(&nd.dentry->d_inode->i_sem);
754 @@ -1648,7 +1829,18 @@
756 if (old_nd.mnt != nd.mnt)
758 - new_dentry = lookup_create(&nd, 0);
759 + if (nd.last_type != LAST_NORM) {
763 + if (nd.dentry->d_inode->i_op->link_raw) {
764 + struct inode_operations *op = nd.dentry->d_inode->i_op;
765 + error = op->link_raw(&old_nd, &nd);
766 + /* the file system wants to use normal vfs path now */
767 + if (error != -EOPNOTSUPP)
770 + new_dentry = lookup_create(&nd, 0, NULL);
771 error = PTR_ERR(new_dentry);
772 if (!IS_ERR(new_dentry)) {
773 error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
774 @@ -1694,7 +1882,7 @@
777 int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
778 - struct inode *new_dir, struct dentry *new_dentry)
779 + struct inode *new_dir, struct dentry *new_dentry)
782 struct inode *target;
783 @@ -1775,7 +1963,7 @@
786 int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
787 - struct inode *new_dir, struct dentry *new_dentry)
788 + struct inode *new_dir, struct dentry *new_dentry)
792 @@ -1866,9 +2054,18 @@
793 if (newnd.last_type != LAST_NORM)
796 + if (old_dir->d_inode->i_op->rename_raw) {
798 + error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
800 + /* the file system wants to use normal vfs path now */
801 + if (error != -EOPNOTSUPP)
805 double_lock(new_dir, old_dir);
807 - old_dentry = lookup_hash(&oldnd.last, old_dir);
808 + old_dentry = lookup_hash_it(&oldnd.last, old_dir, NULL);
809 error = PTR_ERR(old_dentry);
810 if (IS_ERR(old_dentry))
812 @@ -1884,16 +2081,16 @@
813 if (newnd.last.name[newnd.last.len])
816 - new_dentry = lookup_hash(&newnd.last, new_dir);
817 + new_dentry = lookup_hash_it(&newnd.last, new_dir, NULL);
818 error = PTR_ERR(new_dentry);
819 if (IS_ERR(new_dentry))
824 error = vfs_rename(old_dir->d_inode, old_dentry,
825 new_dir->d_inode, new_dentry);
831 @@ -1944,20 +2141,26 @@
835 -__vfs_follow_link(struct nameidata *nd, const char *link)
836 +__vfs_follow_link(struct nameidata *nd, const char *link,
837 + struct lookup_intent *it)
846 + else if (it != nd->intent)
847 + printk("it != nd->intent: tell phil@clusterfs.com\n");
851 if (!walk_init_root(link, nd))
852 /* weird __emul_prefix() stuff did it */
855 - res = link_path_walk(link, nd);
856 + res = link_path_walk_it(link, nd, it);
858 if (current->link_count || res || nd->last_type!=LAST_NORM)
860 @@ -1979,7 +2182,13 @@
862 int vfs_follow_link(struct nameidata *nd, const char *link)
864 - return __vfs_follow_link(nd, link);
865 + return __vfs_follow_link(nd, link, NULL);
868 +int vfs_follow_link_it(struct nameidata *nd, const char *link,
869 + struct lookup_intent *it)
871 + return __vfs_follow_link(nd, link, it);
874 /* get the link contents into pagecache */
875 @@ -2021,7 +2230,7 @@
877 struct page *page = NULL;
878 char *s = page_getlink(dentry, &page);
879 - int res = __vfs_follow_link(nd, s);
880 + int res = __vfs_follow_link(nd, s, NULL);
883 page_cache_release(page);
884 Index: linux-2.4.19-pre1/fs/namespace.c
885 ===================================================================
886 --- linux-2.4.19-pre1.orig/fs/namespace.c 2003-11-21 02:41:00.000000000 +0300
887 +++ linux-2.4.19-pre1/fs/namespace.c 2003-11-21 02:51:38.000000000 +0300
890 old_nd->dentry = mnt->mnt_mountpoint;
891 old_nd->mnt = mnt->mnt_parent;
892 + UNPIN(old_nd->dentry, old_nd->mnt, 1);
893 mnt->mnt_parent = mnt;
894 mnt->mnt_mountpoint = mnt->mnt_root;
895 list_del_init(&mnt->mnt_child);
898 mnt->mnt_parent = mntget(nd->mnt);
899 mnt->mnt_mountpoint = dget(nd->dentry);
900 + PIN(nd->dentry, nd->mnt, 1);
901 list_add(&mnt->mnt_hash, mount_hashtable+hash(nd->mnt, nd->dentry));
902 list_add(&mnt->mnt_child, &nd->mnt->mnt_mounts);
903 nd->dentry->d_mounted++;
908 -static int do_umount(struct vfsmount *mnt, int flags)
909 +int do_umount(struct vfsmount *mnt, int flags)
911 struct super_block * sb = mnt->mnt_sb;
913 @@ -500,15 +502,18 @@
915 struct nameidata old_nd;
916 struct vfsmount *mnt = NULL;
917 + struct lookup_intent it = { .it_op = IT_GETATTR };
918 int err = mount_is_safe(nd);
921 if (!old_name || !*old_name)
923 if (path_init(old_name, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &old_nd))
924 - err = path_walk(old_name, &old_nd);
926 + err = path_walk_it(old_name, &old_nd, &it);
928 + intent_release(&it);
938 + intent_release(&it);
939 path_release(&old_nd);
943 unsigned long flags, void *data_page)
946 + struct lookup_intent it = { .it_op = IT_GETATTR };
952 /* ... and get the mountpoint */
953 if (path_init(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd))
954 - retval = path_walk(dir_name, &nd);
956 + retval = path_walk_it(dir_name, &nd, &it);
958 + intent_release(&it);
962 if (flags & MS_REMOUNT)
963 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
966 retval = do_add_mount(&nd, type_page, flags, mnt_flags,
967 dev_name, data_page);
969 + intent_release(&it);
975 struct vfsmount *tmp;
976 struct nameidata new_nd, old_nd, parent_nd, root_parent, user_nd;
977 + struct lookup_intent new_it = { .it_op = IT_GETATTR };
978 + struct lookup_intent old_it = { .it_op = IT_GETATTR };
985 if (path_init(name, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &new_nd))
986 - error = path_walk(name, &new_nd);
987 + error = path_walk_it(name, &new_nd, &new_it);
994 if (path_init(name, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &old_nd))
995 - error = path_walk(name, &old_nd);
996 + error = path_walk_it(name, &old_nd, &old_it);
1000 @@ -914,8 +927,10 @@
1001 up(&old_nd.dentry->d_inode->i_zombie);
1003 path_release(&user_nd);
1004 + intent_release(&old_it);
1005 path_release(&old_nd);
1007 + intent_release(&new_it);
1008 path_release(&new_nd);
1011 Index: linux-2.4.19-pre1/fs/open.c
1012 ===================================================================
1013 --- linux-2.4.19-pre1.orig/fs/open.c 2003-11-21 02:41:00.000000000 +0300
1014 +++ linux-2.4.19-pre1/fs/open.c 2003-11-21 02:51:38.000000000 +0300
1016 #include <asm/uaccess.h>
1018 #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
1019 +extern int path_walk_it(const char *name, struct nameidata *nd,
1020 + struct lookup_intent *it);
1022 int vfs_statfs(struct super_block *sb, struct statfs *buf)
1028 -int do_truncate(struct dentry *dentry, loff_t length)
1029 +int do_truncate(struct dentry *dentry, loff_t length, int called_from_open)
1031 struct inode *inode = dentry->d_inode;
1032 + struct inode_operations *op = dentry->d_inode->i_op;
1034 struct iattr newattrs;
1037 down(&inode->i_sem);
1038 newattrs.ia_size = length;
1039 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
1040 - error = notify_change(dentry, &newattrs);
1041 + if (called_from_open)
1042 + newattrs.ia_valid |= ATTR_FROM_OPEN;
1043 + if (op->setattr_raw) {
1044 + newattrs.ia_valid |= ATTR_RAW;
1045 + error = op->setattr_raw(inode, &newattrs);
1047 + error = notify_change(dentry, &newattrs);
1051 @@ -94,12 +103,13 @@
1052 struct nameidata nd;
1053 struct inode * inode;
1055 + struct lookup_intent it = { .it_op = IT_GETATTR };
1058 if (length < 0) /* sorry, but loff_t says... */
1061 - error = user_path_walk(path, &nd);
1062 + error = user_path_walk_it(path, &nd, &it);
1065 inode = nd.dentry->d_inode;
1066 @@ -139,11 +149,13 @@
1067 error = locks_verify_truncate(inode, NULL, length);
1070 - error = do_truncate(nd.dentry, length);
1071 + intent_release(&it);
1072 + error = do_truncate(nd.dentry, length, 0);
1074 put_write_access(inode);
1077 + intent_release(&it);
1083 error = locks_verify_truncate(inode, file, length);
1085 - error = do_truncate(dentry, length);
1086 + error = do_truncate(dentry, length, 0);
1090 @@ -236,11 +248,13 @@
1091 struct inode * inode;
1092 struct iattr newattrs;
1094 - error = user_path_walk(filename, &nd);
1095 + error = user_path_walk_it(filename, &nd, NULL);
1098 inode = nd.dentry->d_inode;
1100 + /* this is safe without a Lustre lock because it only depends
1101 + on the super block */
1103 if (IS_RDONLY(inode))
1105 @@ -255,11 +269,25 @@
1108 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
1112 + if (inode->i_op->setattr_raw) {
1113 + struct inode_operations *op = nd.dentry->d_inode->i_op;
1115 + newattrs.ia_valid |= ATTR_RAW;
1116 + error = op->setattr_raw(inode, &newattrs);
1117 + /* the file system wants to use normal vfs path now */
1118 + if (error != -EOPNOTSUPP)
1119 + goto dput_and_out;
1124 if (current->fsuid != inode->i_uid &&
1125 (error = permission(inode,MAY_WRITE)) != 0)
1129 error = notify_change(nd.dentry, &newattrs);
1132 @@ -280,12 +308,14 @@
1133 struct inode * inode;
1134 struct iattr newattrs;
1136 - error = user_path_walk(filename, &nd);
1137 + error = user_path_walk_it(filename, &nd, NULL);
1141 inode = nd.dentry->d_inode;
1143 + /* this is safe without a Lustre lock because it only depends
1144 + on the super block */
1146 if (IS_RDONLY(inode))
1148 @@ -300,7 +330,20 @@
1149 newattrs.ia_atime = times[0].tv_sec;
1150 newattrs.ia_mtime = times[1].tv_sec;
1151 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
1155 + if (inode->i_op->setattr_raw) {
1156 + struct inode_operations *op = nd.dentry->d_inode->i_op;
1158 + newattrs.ia_valid |= ATTR_RAW;
1159 + error = op->setattr_raw(inode, &newattrs);
1160 + /* the file system wants to use normal vfs path now */
1161 + if (error != -EOPNOTSUPP)
1162 + goto dput_and_out;
1167 if ((error = permission(inode,MAY_WRITE)) != 0)
1171 int old_fsuid, old_fsgid;
1172 kernel_cap_t old_cap;
1174 + struct lookup_intent it = { .it_op = IT_GETATTR };
1176 if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
1178 @@ -339,13 +383,14 @@
1180 current->cap_effective = current->cap_permitted;
1182 - res = user_path_walk(filename, &nd);
1183 + res = user_path_walk_it(filename, &nd, &it);
1185 res = permission(nd.dentry->d_inode, mode);
1186 /* SuS v2 requires we report a read only fs too */
1187 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
1188 && !special_file(nd.dentry->d_inode->i_mode))
1190 + intent_release(&it);
1196 struct nameidata nd;
1198 + struct lookup_intent it = { .it_op = IT_GETATTR };
1200 name = getname(filename);
1201 error = PTR_ERR(name);
1205 if (path_init(name,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd))
1206 - error = path_walk(name, &nd);
1207 + error = path_walk_it(name, &nd, &it);
1212 set_fs_pwd(current->fs, nd.mnt, nd.dentry);
1215 + intent_release(&it);
1221 struct nameidata nd;
1223 + struct lookup_intent it = { .it_op = IT_GETATTR };
1225 name = getname(filename);
1226 error = PTR_ERR(name);
1229 path_init(name, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
1230 LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
1231 - error = path_walk(name, &nd);
1232 + error = path_walk_it(name, &nd, &it);
1236 @@ -446,39 +494,56 @@
1240 + intent_release(&it);
1246 -asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
1247 +int chmod_common(struct dentry *dentry, mode_t mode)
1249 - struct inode * inode;
1250 - struct dentry * dentry;
1251 - struct file * file;
1253 + struct inode *inode = dentry->d_inode;
1254 struct iattr newattrs;
1259 + if (IS_RDONLY(inode))
1262 - dentry = file->f_dentry;
1263 - inode = dentry->d_inode;
1264 + if (inode->i_op->setattr_raw) {
1265 + newattrs.ia_mode = mode;
1266 + newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1267 + newattrs.ia_valid |= ATTR_RAW;
1268 + err = inode->i_op->setattr_raw(inode, &newattrs);
1269 + /* the file system wants to use normal vfs path now */
1270 + if (err != -EOPNOTSUPP)
1275 - if (IS_RDONLY(inode))
1278 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1282 if (mode == (mode_t) -1)
1283 mode = inode->i_mode;
1284 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
1285 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1286 err = notify_change(dentry, &newattrs);
1293 +asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
1295 + struct file * file;
1302 + err = chmod_common(file->f_dentry, mode);
1307 @@ -487,30 +552,14 @@
1308 asmlinkage long sys_chmod(const char * filename, mode_t mode)
1310 struct nameidata nd;
1311 - struct inode * inode;
1313 - struct iattr newattrs;
1315 error = user_path_walk(filename, &nd);
1318 - inode = nd.dentry->d_inode;
1321 - if (IS_RDONLY(inode))
1322 - goto dput_and_out;
1325 - if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1326 - goto dput_and_out;
1327 + error = chmod_common(nd.dentry, mode);
1329 - if (mode == (mode_t) -1)
1330 - mode = inode->i_mode;
1331 - newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
1332 - newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
1333 - error = notify_change(nd.dentry, &newattrs);
1339 @@ -530,6 +579,20 @@
1341 if (IS_RDONLY(inode))
1344 + if (inode->i_op->setattr_raw) {
1345 + struct inode_operations *op = dentry->d_inode->i_op;
1347 + newattrs.ia_uid = user;
1348 + newattrs.ia_gid = group;
1349 + newattrs.ia_valid = ATTR_UID | ATTR_GID | ATTR_CTIME;
1350 + newattrs.ia_valid |= ATTR_RAW;
1351 + error = op->setattr_raw(inode, &newattrs);
1352 + /* the file system wants to use normal vfs path now */
1353 + if (error != -EOPNOTSUPP)
1358 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1362 int namei_flags, error;
1363 struct nameidata nd;
1364 + struct lookup_intent it = { .it_op = IT_OPEN };
1366 namei_flags = flags;
1367 if ((namei_flags+1) & O_ACCMODE)
1368 @@ -641,14 +705,15 @@
1369 if (namei_flags & O_TRUNC)
1372 - error = open_namei(filename, namei_flags, mode, &nd);
1374 - return dentry_open(nd.dentry, nd.mnt, flags);
1375 + error = open_namei_it(filename, namei_flags, mode, &nd, &it);
1377 + return ERR_PTR(error);
1379 - return ERR_PTR(error);
1380 + return dentry_open_it(nd.dentry, nd.mnt, flags, &it);
1383 -struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1384 +struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1385 + int flags, struct lookup_intent *it)
1388 struct inode *inode;
1389 @@ -685,12 +750,15 @@
1392 if (f->f_op && f->f_op->open) {
1394 error = f->f_op->open(inode,f);
1399 f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
1401 + intent_release(it);
1405 @@ -705,11 +773,17 @@
1409 + intent_release(it);
1412 return ERR_PTR(error);
1415 +struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
1417 + return dentry_open_it(dentry, mnt, flags, NULL);
1421 * Find an empty file descriptor entry, and mark it busy.
1423 Index: linux-2.4.19-pre1/fs/stat.c
1424 ===================================================================
1425 --- linux-2.4.19-pre1.orig/fs/stat.c 2003-11-21 02:41:00.000000000 +0300
1426 +++ linux-2.4.19-pre1/fs/stat.c 2003-11-21 02:51:38.000000000 +0300
1428 * Revalidate the inode. This is required for proper NFS attribute caching.
1430 static __inline__ int
1431 -do_revalidate(struct dentry *dentry)
1432 +do_revalidate(struct dentry *dentry, struct lookup_intent *it)
1434 struct inode * inode = dentry->d_inode;
1435 - if (inode->i_op && inode->i_op->revalidate)
1436 + if (inode->i_op && inode->i_op->revalidate_it)
1437 + return inode->i_op->revalidate_it(dentry, it);
1438 + else if (inode->i_op && inode->i_op->revalidate)
1439 return inode->i_op->revalidate(dentry);
1442 @@ -135,13 +139,15 @@
1443 asmlinkage long sys_stat(char * filename, struct __old_kernel_stat * statbuf)
1445 struct nameidata nd;
1446 + struct lookup_intent it = { .it_op = IT_GETATTR };
1449 - error = user_path_walk(filename, &nd);
1450 + error = user_path_walk_it(filename, &nd, &it);
1452 - error = do_revalidate(nd.dentry);
1453 + error = do_revalidate(nd.dentry, &it);
1455 error = cp_old_stat(nd.dentry->d_inode, statbuf);
1456 + intent_release(&it);
1460 @@ -151,13 +157,15 @@
1461 asmlinkage long sys_newstat(char * filename, struct stat * statbuf)
1463 struct nameidata nd;
1464 + struct lookup_intent it = { .it_op = IT_GETATTR };
1467 - error = user_path_walk(filename, &nd);
1468 + error = user_path_walk_it(filename, &nd, &it);
1470 - error = do_revalidate(nd.dentry);
1471 + error = do_revalidate(nd.dentry, &it);
1473 error = cp_new_stat(nd.dentry->d_inode, statbuf);
1474 + intent_release(&it);
1478 @@ -172,13 +180,15 @@
1479 asmlinkage long sys_lstat(char * filename, struct __old_kernel_stat * statbuf)
1481 struct nameidata nd;
1482 + struct lookup_intent it = { .it_op = IT_GETATTR };
1485 - error = user_path_walk_link(filename, &nd);
1486 + error = user_path_walk_link_it(filename, &nd, &it);
1488 - error = do_revalidate(nd.dentry);
1489 + error = do_revalidate(nd.dentry, &it);
1491 error = cp_old_stat(nd.dentry->d_inode, statbuf);
1492 + intent_release(&it);
1496 @@ -189,13 +199,15 @@
1497 asmlinkage long sys_newlstat(char * filename, struct stat * statbuf)
1499 struct nameidata nd;
1500 + struct lookup_intent it = { .it_op = IT_GETATTR };
1503 - error = user_path_walk_link(filename, &nd);
1504 + error = user_path_walk_link_it(filename, &nd, &it);
1506 - error = do_revalidate(nd.dentry);
1507 + error = do_revalidate(nd.dentry, &it);
1509 error = cp_new_stat(nd.dentry->d_inode, statbuf);
1510 + intent_release(&it);
1516 struct dentry * dentry = f->f_dentry;
1518 - err = do_revalidate(dentry);
1519 + err = do_revalidate(dentry, NULL);
1521 err = cp_old_stat(dentry->d_inode, statbuf);
1525 struct dentry * dentry = f->f_dentry;
1527 - err = do_revalidate(dentry);
1528 + err = do_revalidate(dentry, NULL);
1530 err = cp_new_stat(dentry->d_inode, statbuf);
1535 if (inode->i_op && inode->i_op->readlink &&
1536 - !(error = do_revalidate(nd.dentry))) {
1537 + !(error = do_revalidate(nd.dentry, NULL))) {
1538 UPDATE_ATIME(inode);
1539 error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
1541 @@ -333,12 +345,14 @@
1543 struct nameidata nd;
1545 + struct lookup_intent it = { .it_op = IT_GETATTR };
1547 - error = user_path_walk(filename, &nd);
1548 + error = user_path_walk_it(filename, &nd, &it);
1550 - error = do_revalidate(nd.dentry);
1551 + error = do_revalidate(nd.dentry, &it);
1553 error = cp_new_stat64(nd.dentry->d_inode, statbuf);
1554 + intent_release(&it);
1558 @@ -348,12 +362,14 @@
1560 struct nameidata nd;
1562 + struct lookup_intent it = { .it_op = IT_GETATTR };
1564 - error = user_path_walk_link(filename, &nd);
1565 + error = user_path_walk_link_it(filename, &nd, &it);
1567 - error = do_revalidate(nd.dentry);
1568 + error = do_revalidate(nd.dentry, &it);
1570 error = cp_new_stat64(nd.dentry->d_inode, statbuf);
1571 + intent_release(&it);
1577 struct dentry * dentry = f->f_dentry;
1579 - err = do_revalidate(dentry);
1580 + err = do_revalidate(dentry, NULL);
1582 err = cp_new_stat64(dentry->d_inode, statbuf);
1584 Index: linux-2.4.19-pre1/include/linux/dcache.h
1585 ===================================================================
1586 --- linux-2.4.19-pre1.orig/include/linux/dcache.h 2003-11-21 02:41:00.000000000 +0300
1587 +++ linux-2.4.19-pre1/include/linux/dcache.h 2003-11-21 02:51:38.000000000 +0300
1590 #include <asm/atomic.h>
1591 #include <linux/mount.h>
1592 +#include <linux/string.h>
1594 +#define IT_OPEN 0x0001
1595 +#define IT_CREAT 0x0002
1596 +#define IT_READDIR 0x0004
1597 +#define IT_GETATTR 0x0008
1598 +#define IT_LOOKUP 0x0010
1599 +#define IT_UNLINK 0x0020
1600 +#define IT_GETXATTR 0x0040
1601 +#define IT_EXEC 0x0080
1602 +#define IT_PIN 0x0100
1603 +#define IT_CHDIR 0x0200
1605 +#define IT_FL_LOCKED 0x0001
1606 +#define IT_FL_FOLLOWED 0x0002 /* set by vfs_follow_link */
1608 +#define INTENT_MAGIC 0x19620323
1611 +struct lustre_intent_data {
1612 + int it_disposition;
1614 + __u64 it_lock_handle;
1619 +struct lookup_intent {
1621 + void (*it_op_release)(struct lookup_intent *);
1624 + int it_create_mode;
1626 + struct lustre_intent_data lustre;
1630 +static inline void intent_init(struct lookup_intent *it, int op, int flags)
1632 + memset(it, 0, sizeof(*it));
1633 + it->it_magic = INTENT_MAGIC;
1635 + it->it_flags = flags;
1640 * linux/include/linux/dcache.h
1642 unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */
1647 struct dentry_operations {
1648 int (*d_revalidate)(struct dentry *, int);
1649 int (*d_hash) (struct dentry *, struct qstr *);
1651 int (*d_delete)(struct dentry *);
1652 void (*d_release)(struct dentry *);
1653 void (*d_iput)(struct dentry *, struct inode *);
1654 + int (*d_revalidate_it)(struct dentry *, int, struct nameidata *, struct lookup_intent *);
1655 + void (*d_pin)(struct dentry *, struct vfsmount * , int);
1656 + void (*d_unpin)(struct dentry *, struct vfsmount *, int);
1659 +#define PIN(de,mnt,flag) if (de && de->d_op && de->d_op->d_pin) \
1660 + de->d_op->d_pin(de, mnt, flag);
1661 +#define UNPIN(de,mnt,flag) if (de && de->d_op && de->d_op->d_unpin) \
1662 + de->d_op->d_unpin(de, mnt, flag);
1665 +/* defined in fs/namei.c */
1666 +extern void intent_release(struct lookup_intent *it);
1667 +/* defined in fs/dcache.c */
1668 +extern void __d_rehash(struct dentry * entry, int lock);
1670 /* the dentry parameter passed to d_hash and d_compare is the parent
1671 * directory of the entries to be compared. It is used in case these
1672 * functions need any directory specific information for determining
1674 * s_nfsd_free_path semaphore will be down
1676 #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
1677 +#define DCACHE_LUSTRE_INVALID 0x0010 /* Lustre invalidated */
1679 extern spinlock_t dcache_lock;
1681 Index: linux-2.4.19-pre1/include/linux/fs.h
1682 ===================================================================
1683 --- linux-2.4.19-pre1.orig/include/linux/fs.h 2003-11-21 02:51:37.000000000 +0300
1684 +++ linux-2.4.19-pre1/include/linux/fs.h 2003-11-21 02:51:38.000000000 +0300
1687 #define FMODE_READ 1
1688 #define FMODE_WRITE 2
1689 +#define FMODE_EXEC 4
1694 #define ATTR_MTIME_SET 256
1695 #define ATTR_FORCE 512 /* Not a change, but a change it */
1696 #define ATTR_ATTR_FLAG 1024
1697 +#define ATTR_RAW 0x0800 /* file system, not vfs will massage attrs */
1698 +#define ATTR_FROM_OPEN 0x1000 /* called from open path, ie O_TRUNC */
1699 +#define ATTR_CTIME_SET 0x2000
1702 * This is the Inode Attributes structure, used for notify_change(). It
1704 struct pipe_inode_info *i_pipe;
1705 struct block_device *i_bdev;
1706 struct char_device *i_cdev;
1707 + void *i_filterdata;
1709 unsigned long i_dnotify_mask; /* Directory notify events */
1710 struct dnotify_struct *i_dnotify; /* for directory notifications */
1713 /* needed for tty driver, and maybe others */
1715 + struct lookup_intent *f_it;
1717 /* preallocated helper kiobuf to speedup O_DIRECT */
1718 struct kiobuf *f_iobuf;
1723 + struct lookup_intent *intent;
1726 #define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */
1728 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1729 extern int vfs_rmdir(struct inode *, struct dentry *);
1730 extern int vfs_unlink(struct inode *, struct dentry *);
1731 -extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
1732 +int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1733 + struct inode *new_dir, struct dentry *new_dentry);
1737 @@ -837,21 +845,32 @@
1739 struct inode_operations {
1740 int (*create) (struct inode *,struct dentry *,int);
1741 + int (*create_it) (struct inode *,struct dentry *,int, struct lookup_intent *);
1742 struct dentry * (*lookup) (struct inode *,struct dentry *);
1743 + struct dentry * (*lookup_it) (struct inode *,struct dentry *, struct nameidata *, struct lookup_intent *, int flags);
1744 int (*link) (struct dentry *,struct inode *,struct dentry *);
1745 + int (*link_raw) (struct nameidata *,struct nameidata *);
1746 int (*unlink) (struct inode *,struct dentry *);
1747 + int (*unlink_raw) (struct nameidata *);
1748 int (*symlink) (struct inode *,struct dentry *,const char *);
1749 + int (*symlink_raw) (struct nameidata *,const char *);
1750 int (*mkdir) (struct inode *,struct dentry *,int);
1751 + int (*mkdir_raw) (struct nameidata *,int);
1752 int (*rmdir) (struct inode *,struct dentry *);
1753 + int (*rmdir_raw) (struct nameidata *);
1754 int (*mknod) (struct inode *,struct dentry *,int,int);
1755 + int (*mknod_raw) (struct nameidata *,int,dev_t);
1756 int (*rename) (struct inode *, struct dentry *,
1757 struct inode *, struct dentry *);
1758 + int (*rename_raw) (struct nameidata *, struct nameidata *);
1759 int (*readlink) (struct dentry *, char *,int);
1760 int (*follow_link) (struct dentry *, struct nameidata *);
1761 void (*truncate) (struct inode *);
1762 int (*permission) (struct inode *, int);
1763 int (*revalidate) (struct dentry *);
1764 + int (*revalidate_it) (struct dentry *, struct lookup_intent *);
1765 int (*setattr) (struct dentry *, struct iattr *);
1766 + int (*setattr_raw) (struct inode *, struct iattr *);
1767 int (*getattr) (struct dentry *, struct iattr *);
1771 int (*remount_fs) (struct super_block *, int *, char *);
1772 void (*clear_inode) (struct inode *);
1773 void (*umount_begin) (struct super_block *);
1774 + void (*umount_lustre) (struct super_block *);
1776 /* Following are for knfsd to interact with "interesting" filesystems
1777 * Currently just reiserfs, but possibly FAT and others later
1778 @@ -1049,10 +1068,16 @@
1780 asmlinkage long sys_open(const char *, int, int);
1781 asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
1782 -extern int do_truncate(struct dentry *, loff_t start);
1783 +extern int do_truncate(struct dentry *, loff_t start, int called_from_open);
1784 +struct dentry *lookup_create(struct nameidata *nd, int is_dir,
1785 + struct lookup_intent *it);
1787 extern struct file *filp_open(const char *, int, int);
1788 extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
1789 +extern int open_namei_it(const char *filename, int namei_flags, int mode,
1790 + struct nameidata *nd, struct lookup_intent *it);
1791 +extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
1792 + int flags, struct lookup_intent *it);
1793 extern int filp_close(struct file *, fl_owner_t id);
1794 extern char * getname(const char *);
1796 @@ -1306,6 +1329,7 @@
1797 extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
1799 extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
1800 +extern int FASTCALL(__user_walk_it(const char *, unsigned, struct nameidata *, struct lookup_intent *it));
1801 extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
1802 extern int FASTCALL(path_walk(const char *, struct nameidata *));
1803 extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
1804 @@ -1316,6 +1340,8 @@
1805 extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
1806 #define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
1807 #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
1808 +#define user_path_walk_it(name,nd,it) __user_walk_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd, it)
1809 +#define user_path_walk_link_it(name,nd,it) __user_walk_it(name, LOOKUP_POSITIVE, nd, it)
1811 extern void iput(struct inode *);
1812 extern void force_delete(struct inode *);
1813 @@ -1423,6 +1449,8 @@
1815 extern int vfs_readlink(struct dentry *, char *, int, const char *);
1816 extern int vfs_follow_link(struct nameidata *, const char *);
1817 +extern int vfs_follow_link_it(struct nameidata *, const char *,
1818 + struct lookup_intent *it);
1819 extern int page_readlink(struct dentry *, char *, int);
1820 extern int page_follow_link(struct dentry *, struct nameidata *);
1821 extern struct inode_operations page_symlink_inode_operations;
1822 Index: linux-2.4.19-pre1/include/linux/fs_struct.h
1823 ===================================================================
1824 --- linux-2.4.19-pre1.orig/include/linux/fs_struct.h 2003-11-21 02:41:00.000000000 +0300
1825 +++ linux-2.4.19-pre1/include/linux/fs_struct.h 2003-11-21 02:51:38.000000000 +0300
1827 write_lock(&fs->lock);
1828 old_root = fs->root;
1829 old_rootmnt = fs->rootmnt;
1830 + PIN(dentry, mnt, 1);
1831 fs->rootmnt = mntget(mnt);
1832 fs->root = dget(dentry);
1833 write_unlock(&fs->lock);
1835 + UNPIN(old_root, old_rootmnt, 1);
1837 mntput(old_rootmnt);
1840 write_lock(&fs->lock);
1842 old_pwdmnt = fs->pwdmnt;
1843 + PIN(dentry, mnt, 0);
1844 fs->pwdmnt = mntget(mnt);
1845 fs->pwd = dget(dentry);
1846 write_unlock(&fs->lock);
1848 + UNPIN(old_pwd, old_pwdmnt, 0);
1852 Index: linux-2.4.19-pre1/kernel/exit.c
1853 ===================================================================
1854 --- linux-2.4.19-pre1.orig/kernel/exit.c 2003-11-21 02:41:00.000000000 +0300
1855 +++ linux-2.4.19-pre1/kernel/exit.c 2003-11-21 02:51:38.000000000 +0300
1856 @@ -245,11 +245,14 @@
1858 /* No need to hold fs->lock if we are killing it */
1859 if (atomic_dec_and_test(&fs->count)) {
1860 + UNPIN(fs->pwd, fs->pwdmnt, 0);
1861 + UNPIN(fs->root, fs->rootmnt, 1);
1863 mntput(fs->rootmnt);
1867 + UNPIN(fs->altroot, fs->altrootmnt, 1);
1869 mntput(fs->altrootmnt);
1871 Index: linux-2.4.19-pre1/kernel/fork.c
1872 ===================================================================
1873 --- linux-2.4.19-pre1.orig/kernel/fork.c 2003-11-21 02:41:00.000000000 +0300
1874 +++ linux-2.4.19-pre1/kernel/fork.c 2003-11-21 02:51:38.000000000 +0300
1875 @@ -372,10 +372,13 @@
1876 fs->umask = old->umask;
1877 read_lock(&old->lock);
1878 fs->rootmnt = mntget(old->rootmnt);
1879 + PIN(old->pwd, old->pwdmnt, 0);
1880 + PIN(old->root, old->rootmnt, 1);
1881 fs->root = dget(old->root);
1882 fs->pwdmnt = mntget(old->pwdmnt);
1883 fs->pwd = dget(old->pwd);
1885 + PIN(old->altroot, old->altrootmnt, 1);
1886 fs->altrootmnt = mntget(old->altrootmnt);
1887 fs->altroot = dget(old->altroot);
1889 Index: linux-2.4.19-pre1/kernel/ksyms.c
1890 ===================================================================
1891 --- linux-2.4.19-pre1.orig/kernel/ksyms.c 2003-11-21 02:51:37.000000000 +0300
1892 +++ linux-2.4.19-pre1/kernel/ksyms.c 2003-11-21 02:51:38.000000000 +0300
1894 EXPORT_SYMBOL(set_page_dirty);
1895 EXPORT_SYMBOL(vfs_readlink);
1896 EXPORT_SYMBOL(vfs_follow_link);
1897 +EXPORT_SYMBOL(vfs_follow_link_it);
1898 +EXPORT_SYMBOL(do_umount);
1899 +EXPORT_SYMBOL(lookup_create);
1900 EXPORT_SYMBOL(page_readlink);
1901 EXPORT_SYMBOL(page_follow_link);
1902 EXPORT_SYMBOL(page_symlink_inode_operations);
1903 ===== include/linux/mount.h 1.7 vs edited =====
1904 --- linux-2.4.19-pre1.orig/include/linux/mount.h Tue Feb 5 09:49:35 2002
1905 +++ linux-2.4.19-pre1/include/linux/mount.h Tue May 4 19:23:48 2004
1908 char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
1909 struct list_head mnt_list;
1910 + struct list_head mnt_lustre_list; /* GNS mount list */
1911 + unsigned long mnt_last_used; /* for GNS auto-umount (jiffies) */
1914 static inline struct vfsmount *mntget(struct vfsmount *mnt)
1918 extern void __mntput(struct vfsmount *mnt);
1919 +extern int do_umount(struct vfsmount *mnt, int flags);
1921 static inline void mntput(struct vfsmount *mnt)