Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / vfs_races-2.6-fc3.patch
1 Index: linux-2.6.11/fs/dcache.c
2 ===================================================================
3 --- linux-2.6.11.orig/fs/dcache.c       2005-04-13 22:44:37.698760922 -0400
4 +++ linux-2.6.11/fs/dcache.c    2005-04-13 22:44:50.482498026 -0400
5 @@ -1197,15 +1197,24 @@
6   * Adds a dentry to the hash according to its name.
7   */
8   
9 -void d_rehash(struct dentry * entry)
10 +void d_rehash_cond(struct dentry * entry, int lock)
11  {
12         struct hlist_head *list = d_hash(entry->d_parent, entry->d_name.hash);
13  
14 -       spin_lock(&dcache_lock);
15 +       if (lock)
16 +               spin_lock(&dcache_lock);
17         spin_lock(&entry->d_lock);
18         __d_rehash(entry, list);
19         spin_unlock(&entry->d_lock);
20 -       spin_unlock(&dcache_lock);
21 +       if (lock)
22 +               spin_unlock(&dcache_lock);
23 +}
24 +
25 +EXPORT_SYMBOL(d_rehash_cond);
26 +
27 +void d_rehash(struct dentry * entry)
28 +{
29 +       d_rehash_cond(entry, 1);
30  }
31  
32  #define do_switch(x,y) do { \
33 Index: linux-2.6.11/include/linux/dcache.h
34 ===================================================================
35 --- linux-2.6.11.orig/include/linux/dcache.h    2005-04-13 22:35:23.515178600 -0400
36 +++ linux-2.6.11/include/linux/dcache.h 2005-04-13 22:44:43.188221365 -0400
37 @@ -159,6 +159,8 @@
38  
39  #define DCACHE_REFERENCED      0x0008  /* Recently used, don't discard. */
40  #define DCACHE_UNHASHED                0x0010  
41 +#define DCACHE_LUSTRE_INVALID     0x0020  /* Lustre invalidated */
42 +
43  
44  extern spinlock_t dcache_lock;
45  
46 @@ -254,6 +255,7 @@ extern int have_submounts(struct dentry 
47   * This adds the entry to the hash queues.
48   */
49  extern void d_rehash(struct dentry *);
50 +extern void d_rehash_cond(struct dentry *, int lock);
51  
52  /**
53   * d_add - add dentry to hash queues