]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Linux: 2.6.38: dentry->d_count is not an atomic
authorMarc Dionne <marc.c.dionne@gmail.com>
Thu, 3 Feb 2011 02:55:27 +0000 (21:55 -0500)
committerRuss Allbery <rra@debian.org>
Tue, 1 Mar 2011 00:03:33 +0000 (16:03 -0800)
d_count is now an int protected by the dentry's d_lock.
Take the lock when we use it, instead of using an atomic_*
function.

Reviewed-on: http://gerrit.openafs.org/3883
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 281f5bf5fbb0a546edcce62ef4e097ae9bbdbf73)

Change-Id: Id30054cb110720632f6f4a7fc4d7860cb69cb1e7
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-on: http://gerrit.openafs.org/3999
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Russ Allbery <rra@stanford.edu>
(cherry picked from commit fe8d833e53938319d1fb6e20153a50a74bed5860)

acinclude.m4
src/afs/LINUX/osi_vnodeops.c
src/cf/linux-test4.m4

index 655fb11adaad1362f08d251d6ed990e82571d348..c3f5e15b060c69b0813b186348bf2d953ef9738b 100644 (file)
@@ -818,6 +818,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_INIT_WORK_HAS_DATA
                 LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
                 LINUX_HAVE_DCACHE_LOCK
+                LINUX_D_COUNT_IS_INT
                 LINUX_SYSCTL_TABLE_CHECKING
                 LINUX_STRUCT_CTL_TABLE_HAS_CTL_NAME
                 LINUX_HAVE_IGET
index e2a3e283bdfcb87f8ae2f498569ec52b4f9e6e20..8b0b6f19a18065ab1dda5ff3290b762a0a06eb64 100644 (file)
@@ -1396,10 +1396,19 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp,
 #endif
 
 #if defined(AFS_LINUX24_ENV)
+#if defined(D_COUNT_INT)
+    spin_lock(&olddp->d_lock);
+    if (olddp->d_count > 1) {
+       spin_unlock(&olddp->d_lock);
+       shrink_dcache_parent(olddp);
+    } else
+       spin_unlock(&olddp->d_lock);
+#else
     if (atomic_read(&olddp->d_count) > 1)
        shrink_dcache_parent(olddp);
 #endif
 
+
     AFS_GLOCK();
     code = afs_rename(VTOAFS(oldip), oldname, VTOAFS(newip), newname, credp);
     AFS_GUNLOCK();
index 2f426ce64799b6e1a7c10bb70183bcb3d9466fa6..b428f37549856571ffc2208c58ce55d5f0690cc7 100644 (file)
@@ -1327,3 +1327,15 @@ AC_DEFUN([LINUX_HAVE_DCACHE_LOCK], [
                        [])
 ])
 
+
+AC_DEFUN([LINUX_D_COUNT_IS_INT], [
+  AC_CHECK_LINUX_BUILD([if dentry->d_count is an int],
+                       [ac_cv_linux_d_count_int],
+                       [#include <linux/dcache.h> ],
+                       [struct dentry _d;
+                       dget(&_d);
+                       _d.d_count = 1;],
+                       [D_COUNT_INT],
+                       [define if dentry->d_count is an int],
+                       [-Werror])
+])