Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / vfs_races-2.6-rhel4.patch
1 diff -urp RH_2_6_9_42_0_3.orig/fs/dcache.c RH_2_6_9_42_0_3/fs/dcache.c
2 --- RH_2_6_9_42_0_3.orig/fs/dcache.c
3 +++ RH_2_6_9_42_0_3/fs/dcache.c
4 @@ -229,7 +229,14 @@ int d_invalidate(struct dentry * dentry)
5                 spin_unlock(&dcache_lock);
6                 return 0;
7         }
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          */
20 @@ -1187,19 +1194,28 @@ void d_delete(struct dentry * dentry)
21   * Adds a dentry to the hash according to its name.
22   */
23   
24 -void d_rehash(struct dentry * entry)
25 +void d_rehash_cond(struct dentry * entry, int lock)
26  {
27         struct hlist_head *list = d_hash(entry->d_parent, entry->d_name.hash);
28  
29 -       spin_lock(&dcache_lock);
30 +       if (lock)
31 +               spin_lock(&dcache_lock);
32         spin_lock(&entry->d_lock);
33         entry->d_flags &= ~DCACHE_UNHASHED;
34         spin_unlock(&entry->d_lock);
35         entry->d_bucket = list;
36         hlist_add_head_rcu(&entry->d_hash, list);
37 -       spin_unlock(&dcache_lock);
38 +       if (lock)
39 +               spin_unlock(&dcache_lock);
40  }
41  
42 +EXPORT_SYMBOL(d_rehash_cond);
43 +
44 +void d_rehash(struct dentry * entry)
45 +{
46 +       d_rehash_cond(entry, 1);
47 +}
48 +
49  #define do_switch(x,y) do { \
50         __typeof__ (x) __tmp = x; \
51         x = y; y = __tmp; } while (0)
52 diff -urp RH_2_6_9_42_0_3.orig/include/linux/dcache.h RH_2_6_9_42_0_3/include/linux/dcache.h
53 --- RH_2_6_9_42_0_3.orig/include/linux/dcache.h
54 +++ RH_2_6_9_42_0_3/include/linux/dcache.h
55 @@ -157,6 +157,8 @@ d_iput:             no              no              no       yes
56  
57  #define DCACHE_REFERENCED      0x0008  /* Recently used, don't discard. */
58  #define DCACHE_UNHASHED                0x0010  
59 +#define DCACHE_LUSTRE_INVALID     0x0020  /* Lustre invalidated */
60 +
61  
62  extern spinlock_t dcache_lock;
63