Whamcloud - gitweb
- highmem-split-2.6.10-fc3.patch in order to make 3GB memory on mountain's
[fs/lustre-release.git] / lustre / kernel_patches / patches / vfs_races-2.6-vanilla.patch
1 Index: linux-2.6.7-vanilla/fs/dcache.c
2 ===================================================================
3 --- linux-2.6.7-vanilla.orig/fs/dcache.c        2004-07-01 12:09:19.000000000 +0300
4 +++ linux-2.6.7-vanilla/fs/dcache.c     2004-07-01 12:29:12.510193264 +0300
5 @@ -219,7 +219,14 @@
6                 spin_unlock(&dcache_lock);
7                 return 0;
8         }
9 -       /*
10 +
11 +        /* network invalidation by Lustre */
12 +       if (dentry->d_flags & DCACHE_LUSTRE_INVALID) {
13 +               spin_unlock(&dcache_lock);
14 +               return 0;
15 +       }
16 +
17 +        /*
18          * Check whether to do a partial shrink_dcache
19          * to get rid of unused child entries.
20          */
21 @@ -1114,19 +1121,28 @@
22   * Adds a dentry to the hash according to its name.
23   */
24   
25 -void d_rehash(struct dentry * entry)
26 +void __d_rehash(struct dentry * entry, int lock)
27  {
28         struct hlist_head *list = d_hash(entry->d_parent, entry->d_name.hash);
29  
30 -       spin_lock(&dcache_lock);
31 +       if (lock)
32 +               spin_lock(&dcache_lock);
33         spin_lock(&entry->d_lock);
34         entry->d_flags &= ~DCACHE_UNHASHED;
35         spin_unlock(&entry->d_lock);
36         entry->d_bucket = list;
37         hlist_add_head_rcu(&entry->d_hash, list);
38 -       spin_unlock(&dcache_lock);
39 +       if (lock)
40 +               spin_unlock(&dcache_lock);
41  }
42  
43 +EXPORT_SYMBOL(__d_rehash);
44 +
45 +void d_rehash(struct dentry * entry)
46 +{
47 +       __d_rehash(entry, 1);
48 + }
49 +
50  #define do_switch(x,y) do { \
51         __typeof__ (x) __tmp = x; \
52         x = y; y = __tmp; } while (0)
53 Index: linux-2.6.7-vanilla/include/linux/dcache.h
54 ===================================================================
55 --- linux-2.6.7-vanilla.orig/include/linux/dcache.h     2004-07-01 12:24:53.602553208 +0300
56 +++ linux-2.6.7-vanilla/include/linux/dcache.h  2004-07-01 12:27:29.757814000 +0300
57 @@ -159,6 +159,8 @@
58  
59  #define DCACHE_REFERENCED      0x0008  /* Recently used, don't discard. */
60  #define DCACHE_UNHASHED                0x0010  
61 +#define DCACHE_LUSTRE_INVALID     0x0020  /* Lustre invalidated */
62 +
63  
64  extern spinlock_t dcache_lock;
65