Whamcloud - gitweb
b=13620
[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 @@ -1183,7 +1183,7 @@
6         spin_unlock(&dcache_lock);
7  }
8  
9 -static void __d_rehash(struct dentry * entry, struct hlist_head *list)
10 +static void __d_rehash_internal(struct dentry * entry, struct hlist_head *list)
11  {
12  
13         entry->d_flags &= ~DCACHE_UNHASHED;
14 @@ -1197,15 +1197,24 @@
15   * Adds a dentry to the hash according to its name.
16   */
17   
18 -void d_rehash(struct dentry * entry)
19 +void __d_rehash(struct dentry * entry, int lock)
20  {
21         struct hlist_head *list = d_hash(entry->d_parent, entry->d_name.hash);
22  
23 -       spin_lock(&dcache_lock);
24 +       if (lock)
25 +               spin_lock(&dcache_lock);
26         spin_lock(&entry->d_lock);
27 -       __d_rehash(entry, list);
28 +       __d_rehash_internal(entry, list);
29         spin_unlock(&entry->d_lock);
30 -       spin_unlock(&dcache_lock);
31 +       if (lock)
32 +               spin_unlock(&dcache_lock);
33 +}
34 +
35 +EXPORT_SYMBOL(__d_rehash);
36 +
37 +void d_rehash(struct dentry * entry)
38 +{
39 +       __d_rehash(entry, 1);
40  }
41  
42  #define do_switch(x,y) do { \
43 @@ -1308,7 +1317,7 @@
44  
45  already_unhashed:
46         list = d_hash(target->d_parent, target->d_name.hash);
47 -       __d_rehash(dentry, list);
48 +       __d_rehash_internal(dentry, list);
49  
50         /* Unhash the target: dput() will then get rid of it */
51         __d_drop(target);
52 Index: linux-2.6.11/include/linux/dcache.h
53 ===================================================================
54 --- linux-2.6.11.orig/include/linux/dcache.h    2005-04-13 22:35:23.515178600 -0400
55 +++ linux-2.6.11/include/linux/dcache.h 2005-04-13 22:44:43.188221365 -0400
56 @@ -159,6 +159,8 @@
57  
58  #define DCACHE_REFERENCED      0x0008  /* Recently used, don't discard. */
59  #define DCACHE_UNHASHED                0x0010  
60 +#define DCACHE_LUSTRE_INVALID     0x0020  /* Lustre invalidated */
61 +
62  
63  extern spinlock_t dcache_lock;
64