source: branches/fc15-dev/server/common/patches/openafs-0007-Linux-2.6.38-deal-with-dcache_lock-removal.patch @ 1910

Last change on this file since 1910 was 1835, checked in by achernya, 13 years ago
OpenAFS builds on F15 Get OpenAFS to build on F15, using the cherry-picked patches.
File size: 4.8 KB
RevLine 
[1835]1From 2c3b79c8c242d12398eff647753370787b7cf300 Mon Sep 17 00:00:00 2001
2From: Marc Dionne <marc.c.dionne@gmail.com>
3Date: Fri, 28 Jan 2011 20:59:17 -0500
4Subject: [PATCH 7/8] Linux: 2.6.38: deal with dcache_lock removal
5
6dcache_lock is gone in 2.6.38, and some of the vfs locking rules
7have changed.
8
9Of interest for openafs:
10- inode->i_lock protects the d_alias list
11- dentry->d_lock protects d_unhashed()
12
13Add a new configure test for dcache_lock, and replace its use by
14the appropriate new lock(s).
15
16Reviewed-on: http://gerrit.openafs.org/3771
17Tested-by: BuildBot <buildbot@rampaginggeek.com>
18Reviewed-by: Derrick Brashear <shadow@dementia.org>
19(cherry picked from commit 2eca7aef7b2940e4ef5f9901ce28481af6edb6dd)
20
21Change-Id: Ie405bb1e40cca4ba83bca3e051e2ab54b8850ac6
22Signed-off-by: Anders Kaseorg <andersk@mit.edu>
23Reviewed-on: http://gerrit.openafs.org/3998
24Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
25Tested-by: BuildBot <buildbot@rampaginggeek.com>
26Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
27Reviewed-by: Russ Allbery <rra@stanford.edu>
28Reviewed-on: http://gerrit.openafs.org/4043
29Reviewed-by: Derrick Brashear <shadow@dementia.org>
30Tested-by: Derrick Brashear <shadow@dementia.org>
31---
32 acinclude.m4          |    1 +
33 src/afs/afs_daemons.c |    8 ++++++++
34 src/afs/afs_vcache.c  |   35 +++++++++++++++++++++++++++++++++--
35 src/cf/linux-test4.m4 |   11 +++++++++++
36 4 files changed, 53 insertions(+), 2 deletions(-)
37
38diff --git a/acinclude.m4 b/acinclude.m4
39index 7904e20..655fb11 100644
40--- a/acinclude.m4
41+++ b/acinclude.m4
42@@ -817,6 +817,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
43                 LINUX_GENERIC_FILE_AIO_READ
44                 LINUX_INIT_WORK_HAS_DATA
45                 LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
46+                LINUX_HAVE_DCACHE_LOCK
47                 LINUX_SYSCTL_TABLE_CHECKING
48                 LINUX_STRUCT_CTL_TABLE_HAS_CTL_NAME
49                 LINUX_HAVE_IGET
50diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c
51index bd5bba8..3d9d977 100644
52--- a/src/afs/afs_daemons.c
53+++ b/src/afs/afs_daemons.c
54@@ -376,7 +376,11 @@ afs_CheckRootVolume(void)
55                    dp = d_find_alias(AFSTOV(afs_globalVp));
56                   
57 #if defined(AFS_LINUX24_ENV)
58+#if defined(HAVE_DCACHE_LOCK)
59                    spin_lock(&dcache_lock);
60+#else
61+                   spin_lock(&AFSTOV(vcp)->i_lock);
62+#endif
63 #if defined(AFS_LINUX26_ENV)
64                    spin_lock(&dp->d_lock);
65 #endif
66@@ -388,7 +392,11 @@ afs_CheckRootVolume(void)
67 #if defined(AFS_LINUX26_ENV)
68                    spin_unlock(&dp->d_lock);
69 #endif
70+#if defined(HAVE_DCACHE_LOCK)
71                    spin_unlock(&dcache_lock);
72+#else
73+                   spin_unlock(&AFSTOV(vcp)->i_lock);
74+#endif
75 #endif
76                    dput(dp);
77                   
78diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c
79index 201bae7..63e6a27 100644
80--- a/src/afs/afs_vcache.c
81+++ b/src/afs/afs_vcache.c
82@@ -673,12 +673,15 @@ afs_ShakeLooseVCaches(afs_int32 anumber)
83 #if defined(AFS_LINUX22_ENV)
84            if (tvc != afs_globalVp && VREFCOUNT(tvc) > 1 && tvc->opens == 0) {
85                 struct dentry *dentry;
86+               struct inode *inode = AFSTOV(tvc);
87                 struct list_head *cur, *head;
88                 AFS_GUNLOCK();
89+
90+#if defined(HAVE_DCACHE_LOCK)
91 #if defined(AFS_LINUX24_ENV)
92                 spin_lock(&dcache_lock);
93 #endif
94-               head = &(AFSTOV(tvc))->i_dentry;
95+               head = &inode->i_dentry;
96 
97 restart:
98                 cur = head;
99@@ -687,7 +690,6 @@ restart:
100 
101                    if (d_unhashed(dentry))
102                        continue;
103-
104                    dget_locked(dentry);
105 
106 #if defined(AFS_LINUX24_ENV)
107@@ -707,6 +709,35 @@ restart:
108 #if defined(AFS_LINUX24_ENV)
109                spin_unlock(&dcache_lock);
110 #endif
111+#else /* HAVE_DCACHE_LOCK */
112+               spin_lock(&inode->i_lock);
113+               head = &inode->i_dentry;
114+
115+restart:
116+               cur = head;
117+               while ((cur = cur->next) != head) {
118+                   dentry = list_entry(cur, struct dentry, d_alias);
119+
120+                   spin_lock(&dentry->d_lock);
121+                   if (d_unhashed(dentry)) {
122+                       spin_unlock(&dentry->d_lock);
123+                       continue;
124+                   }
125+                   spin_unlock(&dentry->d_lock);
126+                   dget(dentry);
127+
128+                   spin_unlock(&inode->i_lock);
129+                   if (d_invalidate(dentry) == -EBUSY) {
130+                       dput(dentry);
131+                       /* perhaps lock and try to continue? (use cur as head?) */
132+                       goto inuse;
133+                   }
134+                   dput(dentry);
135+                   spin_lock(&inode->i_lock);
136+                   goto restart;
137+               }
138+               spin_unlock(&inode->i_lock);
139+#endif /* HAVE_DCACHE_LOCK */
140            inuse:
141                AFS_GLOCK();
142            }
143diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
144index 88e4863..2f426ce 100644
145--- a/src/cf/linux-test4.m4
146+++ b/src/cf/linux-test4.m4
147@@ -1316,3 +1316,14 @@ AC_DEFUN([LINUX_HAVE_INODE_SETATTR], [
148   if test "x$ac_cv_linux_inode_setattr" = "xyes"; then
149     AC_DEFINE([HAVE_LINUX_INODE_SETATTR], 1, [define if your kernel has inode_setattr()])
150   fi])
151+
152+AC_DEFUN([LINUX_HAVE_DCACHE_LOCK], [
153+  AC_CHECK_LINUX_BUILD([for dcache_lock],
154+                       [ac_cv_linux_have_dcache_lock],
155+                       [#include <linux/dcache.h> ],
156+                       [printk("%p", &dcache_lock);],
157+                       [HAVE_DCACHE_LOCK],
158+                       [define if dcache_lock exists],
159+                       [])
160+])
161+
162--
1631.7.3.4
164
Note: See TracBrowser for help on using the repository browser.