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.
Change-Id: Ib70e4a5315cc343518fa983e47bc7ff925acfc7f
Reviewed-on: http://gerrit.openafs.org/3883
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
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
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);
[])
])
+
+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])
+])