#endif
}
+/* Use these to lock or unlock an inode for processing
+ * its dentry aliases en masse.
+ */
+#if defined(HAVE_DCACHE_LOCK)
+#define afs_d_alias_lock(ip) spin_lock(&dcache_lock)
+#define afs_d_alias_unlock(ip) spin_unlock(&dcache_lock)
+#else
+#define afs_d_alias_lock(ip) spin_lock(&(ip)->i_lock)
+#define afs_d_alias_unlock(ip) spin_unlock(&(ip)->i_lock)
+#endif
+
+
/* Use this instead of dget for dentry operations
* that occur under a higher lock (e.g. alias processing).
* Requires that the higher lock (e.g. dcache_lock or
#endif
#if defined(HAVE_DCACHE_LOCK)
- spin_lock(&dcache_lock);
+ afs_d_alias_lock(inode);
restart:
list_for_each_entry(dentry, &inode->i_dentry, d_alias) {
continue;
afs_linux_dget(dentry);
- spin_unlock(&dcache_lock);
+ afs_d_alias_unlock(inode);
if (d_invalidate(dentry) == -EBUSY) {
dput(dentry);
/* perhaps lock and try to continue? (use cur as head?) */
goto inuse;
}
dput(dentry);
- spin_lock(&dcache_lock);
+ afs_d_alias_lock(inode);
goto restart;
}
- spin_unlock(&dcache_lock);
+ afs_d_alias_unlock(inode);
#else /* HAVE_DCACHE_LOCK */
- spin_lock(&inode->i_lock);
+ afs_d_alias_lock(inode);
restart:
#if defined(D_ALIAS_IS_HLIST)
spin_unlock(&dentry->d_lock);
afs_linux_dget(dentry);
- spin_unlock(&inode->i_lock);
+ afs_d_alias_unlock(inode);
if (afs_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);
+ afs_d_alias_lock(inode);
goto restart;
}
- spin_unlock(&inode->i_lock);
+ afs_d_alias_unlock(inode);
#endif /* HAVE_DCACHE_LOCK */
inuse:
return;
dp = d_find_alias(root);
-#if defined(HAVE_DCACHE_LOCK)
- spin_lock(&dcache_lock);
-#else
- spin_lock(&AFSTOV(vcp)->i_lock);
-#endif
+ afs_d_alias_lock(AFSTOV(vcp));
+
spin_lock(&dp->d_lock);
#if defined(D_ALIAS_IS_HLIST)
hlist_del_init(&dp->d_alias);
#endif
dp->d_inode = AFSTOV(vcp);
spin_unlock(&dp->d_lock);
-#if defined(HAVE_DCACHE_LOCK)
- spin_unlock(&dcache_lock);
-#else
- spin_unlock(&AFSTOV(vcp)->i_lock);
-#endif
+
+ afs_d_alias_unlock(AFSTOV(vcp));
+
dput(dp);
AFS_RELE(root);
d_prune_aliases(ip);
-# ifdef HAVE_DCACHE_LOCK
- spin_lock(&dcache_lock);
-# else
- spin_lock(&ip->i_lock);
-# endif
+ afs_d_alias_lock(ip);
#if defined(D_ALIAS_IS_HLIST)
# if defined(HLIST_ITERATOR_NO_NODE)
if (ret) {
afs_linux_dget(ret);
}
- spin_unlock(&dcache_lock);
+ afs_d_alias_unlock(ip);
# else
if (ret) {
afs_linux_dget(ret);
}
- spin_unlock(&ip->i_lock);
+ afs_d_alias_unlock(ip);
# endif
return ret;