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