]> 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)
committerJeffrey Altman <jaltman@openafs.org>
Sun, 13 Feb 2011 04:04:01 +0000 (20:04 -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: I45caa6aef451a7f93bfa43dfb1ebe9b0b856fbd0
Reviewed-on: http://gerrit.openafs.org/3935
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
acinclude.m4
src/afs/LINUX/osi_vnodeops.c
src/cf/linux-test4.m4

index 6897a5c1a439b3802dfbbd9f496eff3c7a65b310..0315f69e0e64c8431a000df1cbdc11a3c7e1aea3 100644 (file)
@@ -905,6 +905,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
 
                 dnl If we are guaranteed that keyrings will work - that is
                 dnl  a) The kernel has keyrings enabled
index a7419988112cbf84467bac77d792ea356883ff12..f3ba62a77df09d2c1a256a1489f3c344fc6f586c 100644 (file)
@@ -1306,8 +1306,17 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp,
        rehash = newdp;
     }
 
+#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), (char *)oldname, VTOAFS(newip), (char *)newname, credp);
index 945b4f091c10c884d49320b7b8a83740063c41e4..cf6045a2358710bc9b914b83c80bcb249247cf52 100644 (file)
@@ -592,3 +592,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])
+])