+--- linux-2.6.16.46-0.14.orig/fs/dcache.c
++++ linux-2.6.16.46-0.14/fs/dcache.c
+@@ -1309,17 +1309,26 @@ static void __d_rehash(struct dentry * e
+ * 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)
+ {
+ struct hlist_head *list = d_hash(entry->d_parent, entry->d_name.hash);
+
+- spin_lock(&dcache_lock);
++ if (lock)
++ spin_lock(&dcache_lock);
+ spin_lock(&entry->d_lock);
+ __d_rehash(entry, list);
+ 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);
++ }
++
+ #define do_switch(x,y) do { \
+ __typeof__ (x) __tmp = x; \
+ x = y; y = __tmp; } while (0)
+@@ -1392,14 +1401,13 @@ static void switch_names(struct dentry *