source: branches/fc15-dev/server/common/patches/openafs-0008-Linux-2.6.38-dentry-d_count-is-not-an-atomic.patch @ 1908

Last change on this file since 1908 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: 2.7 KB
RevLine 
[1835]1From 7c3999e05c928991d22e3eeae2c69e5759c6ea4a Mon Sep 17 00:00:00 2001
2From: Marc Dionne <marc.c.dionne@gmail.com>
3Date: Wed, 2 Feb 2011 21:55:27 -0500
4Subject: [PATCH 8/8] Linux: 2.6.38: dentry->d_count is not an atomic
5
6d_count is now an int protected by the dentry's d_lock.
7Take the lock when we use it, instead of using an atomic_*
8function.
9
10Reviewed-on: http://gerrit.openafs.org/3883
11Tested-by: BuildBot <buildbot@rampaginggeek.com>
12Reviewed-by: Derrick Brashear <shadow@dementia.org>
13(cherry picked from commit 281f5bf5fbb0a546edcce62ef4e097ae9bbdbf73)
14
15Change-Id: Id6b17d9cfe18d348a66df02f6b309fc53b00da86
16Signed-off-by: Anders Kaseorg <andersk@mit.edu>
17Reviewed-on: http://gerrit.openafs.org/3999
18Tested-by: BuildBot <buildbot@rampaginggeek.com>
19Reviewed-by: Russ Allbery <rra@stanford.edu>
20Reviewed-on: http://gerrit.openafs.org/4044
21Reviewed-by: Derrick Brashear <shadow@dementia.org>
22Tested-by: Derrick Brashear <shadow@dementia.org>
23---
24 acinclude.m4                 |    1 +
25 src/afs/LINUX/osi_vnodeops.c |    9 +++++++++
26 src/cf/linux-test4.m4        |   12 ++++++++++++
27 3 files changed, 22 insertions(+), 0 deletions(-)
28
29diff --git a/acinclude.m4 b/acinclude.m4
30index 655fb11..c3f5e15 100644
31--- a/acinclude.m4
32+++ b/acinclude.m4
33@@ -818,6 +818,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
34                 LINUX_INIT_WORK_HAS_DATA
35                 LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
36                 LINUX_HAVE_DCACHE_LOCK
37+                LINUX_D_COUNT_IS_INT
38                 LINUX_SYSCTL_TABLE_CHECKING
39                 LINUX_STRUCT_CTL_TABLE_HAS_CTL_NAME
40                 LINUX_HAVE_IGET
41diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
42index e2a3e28..3118ec7 100644
43--- a/src/afs/LINUX/osi_vnodeops.c
44+++ b/src/afs/LINUX/osi_vnodeops.c
45@@ -1396,9 +1396,18 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp,
46 #endif
47 
48 #if defined(AFS_LINUX24_ENV)
49+#if defined(D_COUNT_INT)
50+    spin_lock(&olddp->d_lock);
51+    if (olddp->d_count > 1) {
52+       spin_unlock(&olddp->d_lock);
53+       shrink_dcache_parent(olddp);
54+    } else
55+       spin_unlock(&olddp->d_lock);
56+#else
57     if (atomic_read(&olddp->d_count) > 1)
58        shrink_dcache_parent(olddp);
59 #endif
60+#endif
61 
62     AFS_GLOCK();
63     code = afs_rename(VTOAFS(oldip), oldname, VTOAFS(newip), newname, credp);
64diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
65index 2f426ce..b428f37 100644
66--- a/src/cf/linux-test4.m4
67+++ b/src/cf/linux-test4.m4
68@@ -1327,3 +1327,15 @@ AC_DEFUN([LINUX_HAVE_DCACHE_LOCK], [
69                        [])
70 ])
71 
72+
73+AC_DEFUN([LINUX_D_COUNT_IS_INT], [
74+  AC_CHECK_LINUX_BUILD([if dentry->d_count is an int],
75+                       [ac_cv_linux_d_count_int],
76+                       [#include <linux/dcache.h> ],
77+                       [struct dentry _d;
78+                       dget(&_d);
79+                       _d.d_count = 1;],
80+                       [D_COUNT_INT],
81+                       [define if dentry->d_count is an int],
82+                       [-Werror])
83+])
84--
851.7.3.4
86
Note: See TracBrowser for help on using the repository browser.