Index: linux-2.6.22.5/fs/dcache.c =================================================================== --- linux-2.6.22.5.orig/fs/dcache.c 2007-08-22 17:23:54.000000000 -0600 +++ linux-2.6.22.5/fs/dcache.c 2008-02-21 00:56:09.000000000 -0700 @@ -245,6 +245,13 @@ spin_unlock(&dcache_lock); return 0; } + + /* network invalidation by Lustre */ + if (dentry->d_flags & DCACHE_LUSTRE_INVALID) { + spin_unlock(&dcache_lock); + return 0; + } + /* * Check whether to do a partial shrink_dcache * to get rid of unused child entries. @@ -1441,13 +1448,22 @@ * Adds a dentry to the hash according to its name. */ -void d_rehash(struct dentry * entry) +void d_rehash_cond(struct dentry * entry, int lock) { - spin_lock(&dcache_lock); + if (lock) + spin_lock(&dcache_lock); spin_lock(&entry->d_lock); _d_rehash(entry); spin_unlock(&entry->d_lock); - spin_unlock(&dcache_lock); + if (lock) + spin_unlock(&dcache_lock); +} + +EXPORT_SYMBOL(d_rehash_cond); + +void d_rehash(struct dentry * entry) +{ + d_rehash_cond(entry, 1); } /* Index: linux-2.6.22.5/include/linux/dcache.h =================================================================== --- linux-2.6.22.5.orig/include/linux/dcache.h 2007-08-22 17:23:54.000000000 -0600 +++ linux-2.6.22.5/include/linux/dcache.h 2008-02-21 00:56:09.000000000 -0700 @@ -174,6 +174,7 @@ #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ #define DCACHE_UNHASHED 0x0010 +#define DCACHE_LUSTRE_INVALID 0x0040 /* Lustre invalidated */ #define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched by inotify */