LINUX_KEY_ALLOC_NEEDS_CRED
LINUX_INIT_WORK_HAS_DATA
LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
+ LINUX_HAVE_DCACHE_LOCK
dnl If we are guaranteed that keyrings will work - that is
dnl a) The kernel has keyrings enabled
int code;
struct dentry *dentry;
+ struct inode *inode = AFSTOV(avc);
struct list_head *cur, *head;
/* First, see if we can evict the inode from the dcache */
*slept = 1;
ReleaseWriteLock(&afs_xvcache);
AFS_GUNLOCK();
+
+#if defined(HAVE_DCACHE_LOCK)
spin_lock(&dcache_lock);
- head = &(AFSTOV(avc))->i_dentry;
+ head = &inode->i_dentry;
restart:
cur = head;
if (d_unhashed(dentry))
continue;
-
dget_locked(dentry);
spin_unlock(&dcache_lock);
goto restart;
}
spin_unlock(&dcache_lock);
+#else /* HAVE_DCACHE_LOCK */
+ spin_lock(&inode->i_lock);
+ head = &inode->i_dentry;
+
+restart:
+ cur = head;
+ while ((cur = cur->next) != head) {
+ dentry = list_entry(cur, struct dentry, d_alias);
+
+ spin_lock(&dentry->d_lock);
+ if (d_unhashed(dentry)) {
+ spin_unlock(&dentry->d_lock);
+ continue;
+ }
+ spin_unlock(&dentry->d_lock);
+ dget(dentry);
+
+ spin_unlock(&inode->i_lock);
+ if (d_invalidate(dentry) == -EBUSY) {
+ dput(dentry);
+ /* perhaps lock and try to continue? (use cur as head?) */
+ goto inuse;
+ }
+ dput(dentry);
+ spin_lock(&inode->i_lock);
+ goto restart;
+ }
+ spin_unlock(&inode->i_lock);
+#endif /* HAVE_DCACHE_LOCK */
inuse:
AFS_GLOCK();
ObtainWriteLock(&afs_xvcache, 733);
dp = d_find_alias(AFSTOV(afs_globalVp));
#if defined(AFS_LINUX24_ENV)
+#if defined(HAVE_DCACHE_LOCK)
spin_lock(&dcache_lock);
+#else
+ spin_lock(&AFSTOV(vcp)->i_lock);
+#endif
#if defined(AFS_LINUX26_ENV)
spin_lock(&dp->d_lock);
#endif
#if defined(AFS_LINUX26_ENV)
spin_unlock(&dp->d_lock);
#endif
+#if defined(HAVE_DCACHE_LOCK)
spin_unlock(&dcache_lock);
+#else
+ spin_unlock(&AFSTOV(vcp)->i_lock);
+#endif
#endif
dput(dp);
[])
])
+
+AC_DEFUN([LINUX_HAVE_DCACHE_LOCK], [
+ AC_CHECK_LINUX_BUILD([for dcache_lock],
+ [ac_cv_linux_have_dcache_lock],
+ [#include <linux/dcache.h> ],
+ [printk("%p", &dcache_lock);],
+ [HAVE_DCACHE_LOCK],
+ [define if dcache_lock exists],
+ [])
+])
+