From 7f6c7de4afa316217768d65e12c6358dbbdaf99e Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 13 Sep 2003 12:17:39 +0000 Subject: [PATCH] - fix agaist bug #1322 'clients looping in revalidate after recovery failure' --- .../patches/vfs_intent_2.6.0-test1.patch | 99 +++++++++++++--------- 1 file changed, 61 insertions(+), 38 deletions(-) diff --git a/lustre/kernel_patches/patches/vfs_intent_2.6.0-test1.patch b/lustre/kernel_patches/patches/vfs_intent_2.6.0-test1.patch index e4c1cfb..dc5e666 100644 --- a/lustre/kernel_patches/patches/vfs_intent_2.6.0-test1.patch +++ b/lustre/kernel_patches/patches/vfs_intent_2.6.0-test1.patch @@ -1,17 +1,17 @@ - fs/exec.c | 18 ++++++++--- - fs/namei.c | 78 +++++++++++++++++++++++++++++++++++++++++++++---- + fs/exec.c | 18 +++++++--- + fs/namei.c | 86 +++++++++++++++++++++++++++++++++++++++++++++---- fs/namespace.c | 2 + fs/nfs/dir.c | 4 +- - fs/open.c | 62 +++++++++++++++++++++++++------------- - fs/stat.c | 24 +++++++++++---- + fs/open.c | 62 +++++++++++++++++++++++------------ + fs/stat.c | 24 ++++++++++--- include/linux/dcache.h | 3 + - include/linux/fs.h | 8 +++++ - include/linux/namei.h | 56 +++++++++++++++++++++++++++++------ - kernel/ksyms.c | 8 +++++ - 10 files changed, 215 insertions(+), 48 deletions(-) + include/linux/fs.h | 8 ++++ + include/linux/namei.h | 56 ++++++++++++++++++++++++++----- + kernel/ksyms.c | 8 ++++ + 10 files changed, 222 insertions(+), 49 deletions(-) ---- linux-2.6.0-test1/fs/exec.c~vfs_intent_2.6.0-test1 2003-09-12 23:57:03.000000000 +0400 -+++ linux-2.6.0-test1-alexey/fs/exec.c 2003-09-12 23:57:57.000000000 +0400 +--- linux-2.6.0-test1/fs/exec.c~vfs_intent_2.6.0-test1 2003-09-13 16:01:21.000000000 +0400 ++++ linux-2.6.0-test1-alexey/fs/exec.c 2003-09-13 16:21:05.000000000 +0400 @@ -116,8 +116,11 @@ asmlinkage long sys_uselib(const char __ struct file * file; struct nameidata nd; @@ -59,8 +59,8 @@ if (!IS_ERR(file)) { err = deny_write_access(file); if (err) { ---- linux-2.6.0-test1/fs/namei.c~vfs_intent_2.6.0-test1 2003-09-12 23:57:03.000000000 +0400 -+++ linux-2.6.0-test1-alexey/fs/namei.c 2003-09-12 23:57:57.000000000 +0400 +--- linux-2.6.0-test1/fs/namei.c~vfs_intent_2.6.0-test1 2003-09-13 16:01:21.000000000 +0400 ++++ linux-2.6.0-test1-alexey/fs/namei.c 2003-09-13 16:21:05.000000000 +0400 @@ -263,8 +263,19 @@ int deny_write_access(struct file * file return 0; } @@ -81,7 +81,30 @@ dput(nd->dentry); mntput(nd->mnt); } -@@ -554,6 +565,31 @@ fail: +@@ -340,7 +351,10 @@ static struct dentry * real_lookup(struc + { + struct dentry * result; + struct inode *dir = parent->d_inode; ++ int counter = 0; + ++again: ++ counter++; + down(&dir->i_sem); + /* + * First re-do the cached lookup just in case it was created +@@ -379,7 +393,10 @@ static struct dentry * real_lookup(struc + if (result->d_op && result->d_op->d_revalidate) { + if (!result->d_op->d_revalidate(result, nd) && !d_invalidate(result)) { + dput(result); +- result = ERR_PTR(-ENOENT); ++ if (counter > 10) ++ result = ERR_PTR(-ESTALE); ++ if (!IS_ERR(result)) ++ goto again; + } + } + return result; +@@ -554,6 +571,31 @@ fail: return PTR_ERR(dentry); } @@ -113,7 +136,7 @@ /* * Name resolution. * -@@ -654,7 +690,9 @@ int link_path_walk(const char * name, st +@@ -654,7 +696,9 @@ int link_path_walk(const char * name, st if (inode->i_op->follow_link) { mntget(next.mnt); @@ -123,7 +146,7 @@ dput(next.dentry); mntput(next.mnt); if (err) -@@ -693,6 +731,11 @@ last_component: +@@ -693,6 +737,11 @@ last_component: inode = nd->dentry->d_inode; /* fallthrough */ case 1: @@ -135,7 +158,7 @@ goto return_base; } if (nd->dentry->d_op && nd->dentry->d_op->d_hash) { -@@ -700,7 +743,9 @@ last_component: +@@ -700,7 +749,9 @@ last_component: if (err < 0) break; } @@ -145,7 +168,7 @@ if (err) break; follow_mount(&next.mnt, &next.dentry); -@@ -912,7 +957,7 @@ struct dentry * lookup_hash(struct qstr +@@ -912,7 +963,7 @@ struct dentry * lookup_hash(struct qstr } /* SMP-safe */ @@ -154,7 +177,7 @@ { unsigned long hash; struct qstr this; -@@ -932,11 +977,16 @@ struct dentry * lookup_one_len(const cha +@@ -932,11 +983,16 @@ struct dentry * lookup_one_len(const cha } this.hash = end_name_hash(hash); @@ -172,7 +195,7 @@ /* * namei() * -@@ -948,11 +998,12 @@ access: +@@ -948,11 +1004,12 @@ access: * that namei follows links, while lnamei does not. * SMP-safe */ @@ -186,7 +209,7 @@ if (!IS_ERR(tmp)) { err = path_lookup(tmp, flags, nd); putname(tmp); -@@ -960,6 +1011,12 @@ int __user_walk(const char __user *name, +@@ -960,6 +1017,12 @@ int __user_walk(const char __user *name, return err; } @@ -199,7 +222,7 @@ /* * It's inline, so penalty for filesystems that don't use sticky bit is * minimal. -@@ -1232,8 +1289,8 @@ int open_namei(const char * pathname, in +@@ -1232,8 +1295,8 @@ int open_namei(const char * pathname, in acc_mode |= MAY_APPEND; /* Fill in the open() intent data */ @@ -210,7 +233,7 @@ /* * The simplest case - just a plain lookup. -@@ -1249,6 +1306,7 @@ int open_namei(const char * pathname, in +@@ -1249,6 +1312,7 @@ int open_namei(const char * pathname, in /* * Create - we need to know the parent. */ @@ -218,7 +241,7 @@ error = path_lookup(pathname, LOOKUP_PARENT|LOOKUP_OPEN|LOOKUP_CREATE, nd); if (error) return error; -@@ -1265,7 +1323,9 @@ int open_namei(const char * pathname, in +@@ -1265,7 +1329,9 @@ int open_namei(const char * pathname, in dir = nd->dentry; nd->flags &= ~LOOKUP_PARENT; down(&dir->d_inode->i_sem); @@ -228,7 +251,7 @@ do_last: error = PTR_ERR(dentry); -@@ -1370,7 +1430,9 @@ do_link: +@@ -1370,7 +1436,9 @@ do_link: } dir = nd->dentry; down(&dir->d_inode->i_sem); @@ -238,7 +261,7 @@ putname(nd->last.name); goto do_last; } -@@ -2143,7 +2205,9 @@ static inline int +@@ -2143,7 +2211,9 @@ static inline int __vfs_follow_link(struct nameidata *nd, const char *link) { int res = 0; @@ -248,7 +271,7 @@ if (IS_ERR(link)) goto fail; -@@ -2153,6 +2217,10 @@ __vfs_follow_link(struct nameidata *nd, +@@ -2153,6 +2223,10 @@ __vfs_follow_link(struct nameidata *nd, /* weird __emul_prefix() stuff did it */ goto out; } @@ -259,8 +282,8 @@ res = link_path_walk(link, nd); out: if (current->link_count || res || nd->last_type!=LAST_NORM) ---- linux-2.6.0-test1/fs/namespace.c~vfs_intent_2.6.0-test1 2003-09-12 23:57:03.000000000 +0400 -+++ linux-2.6.0-test1-alexey/fs/namespace.c 2003-09-12 23:57:57.000000000 +0400 +--- linux-2.6.0-test1/fs/namespace.c~vfs_intent_2.6.0-test1 2003-09-13 16:01:21.000000000 +0400 ++++ linux-2.6.0-test1-alexey/fs/namespace.c 2003-09-13 16:21:05.000000000 +0400 @@ -738,6 +738,7 @@ long do_mount(char * dev_name, char * di int retval = 0; int mnt_flags = 0; @@ -278,7 +301,7 @@ static void chroot_fs_refs(struct nameidata *old_nd, struct nameidata *new_nd) { --- linux-2.6.0-test1/fs/open.c~vfs_intent_2.6.0-test1 2003-07-24 15:52:47.000000000 +0400 -+++ linux-2.6.0-test1-alexey/fs/open.c 2003-09-12 23:57:57.000000000 +0400 ++++ linux-2.6.0-test1-alexey/fs/open.c 2003-09-13 16:21:05.000000000 +0400 @@ -200,7 +200,7 @@ static inline long do_sys_truncate(const struct nameidata nd; struct inode * inode; @@ -416,8 +439,8 @@ /* * Find an empty file descriptor entry, and mark it busy. */ ---- linux-2.6.0-test1/fs/stat.c~vfs_intent_2.6.0-test1 2003-09-12 23:57:03.000000000 +0400 -+++ linux-2.6.0-test1-alexey/fs/stat.c 2003-09-12 23:57:57.000000000 +0400 +--- linux-2.6.0-test1/fs/stat.c~vfs_intent_2.6.0-test1 2003-09-13 16:01:21.000000000 +0400 ++++ linux-2.6.0-test1-alexey/fs/stat.c 2003-09-13 16:21:05.000000000 +0400 @@ -33,7 +33,7 @@ void generic_fillattr(struct inode *inod stat->blksize = inode->i_blksize; } @@ -488,7 +511,7 @@ } return error; --- linux-2.6.0-test1/include/linux/dcache.h~vfs_intent_2.6.0-test1 2003-07-24 15:52:31.000000000 +0400 -+++ linux-2.6.0-test1-alexey/include/linux/dcache.h 2003-09-12 23:57:57.000000000 +0400 ++++ linux-2.6.0-test1-alexey/include/linux/dcache.h 2003-09-13 16:21:05.000000000 +0400 @@ -4,6 +4,7 @@ #ifdef __KERNEL__ @@ -506,8 +529,8 @@ struct dentry_stat_t { int nr_dentry; int nr_unused; ---- linux-2.6.0-test1/include/linux/fs.h~vfs_intent_2.6.0-test1 2003-09-12 23:57:08.000000000 +0400 -+++ linux-2.6.0-test1-alexey/include/linux/fs.h 2003-09-12 23:58:32.000000000 +0400 +--- linux-2.6.0-test1/include/linux/fs.h~vfs_intent_2.6.0-test1 2003-09-13 16:01:21.000000000 +0400 ++++ linux-2.6.0-test1-alexey/include/linux/fs.h 2003-09-13 16:21:05.000000000 +0400 @@ -237,6 +237,8 @@ typedef int (get_blocks_t)(struct inode #define ATTR_ATTR_FLAG 1024 #define ATTR_KILL_SUID 2048 @@ -560,7 +583,7 @@ extern char * getname(const char __user *); --- linux-2.6.0-test1/include/linux/namei.h~vfs_intent_2.6.0-test1 2003-07-24 15:52:31.000000000 +0400 -+++ linux-2.6.0-test1-alexey/include/linux/namei.h 2003-09-12 23:57:57.000000000 +0400 ++++ linux-2.6.0-test1-alexey/include/linux/namei.h 2003-09-13 16:21:05.000000000 +0400 @@ -2,25 +2,55 @@ #define _LINUX_NAMEI_H @@ -656,8 +679,8 @@ extern int follow_down(struct vfsmount **, struct dentry **); extern int follow_up(struct vfsmount **, struct dentry **); ---- linux-2.6.0-test1/kernel/ksyms.c~vfs_intent_2.6.0-test1 2003-09-12 23:57:14.000000000 +0400 -+++ linux-2.6.0-test1-alexey/kernel/ksyms.c 2003-09-12 23:57:57.000000000 +0400 +--- linux-2.6.0-test1/kernel/ksyms.c~vfs_intent_2.6.0-test1 2003-09-13 16:01:33.000000000 +0400 ++++ linux-2.6.0-test1-alexey/kernel/ksyms.c 2003-09-13 16:21:05.000000000 +0400 @@ -383,6 +383,7 @@ EXPORT_SYMBOL(unregister_filesystem); EXPORT_SYMBOL(kern_mount); EXPORT_SYMBOL(__mntput); @@ -688,7 +711,7 @@ EXPORT_SYMBOL(new_inode); EXPORT_SYMBOL(__insert_inode_hash); --- linux-2.6.0-test1/fs/nfs/dir.c~vfs_intent_2.6.0-test1 2003-07-24 15:52:31.000000000 +0400 -+++ linux-2.6.0-test1-alexey/fs/nfs/dir.c 2003-09-12 23:57:57.000000000 +0400 ++++ linux-2.6.0-test1-alexey/fs/nfs/dir.c 2003-09-13 16:21:05.000000000 +0400 @@ -650,7 +650,7 @@ int nfs_is_exclusive_create(struct inode return 0; if (!nd || (nd->flags & LOOKUP_CONTINUE) || !(nd->flags & LOOKUP_CREATE)) -- 1.8.3.1