]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
LINUX: create afs_linux_dget() compat wrapper
authorMark Vitale <mvitale@sinenomine.net>
Thu, 30 Nov 2017 21:08:38 +0000 (16:08 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Wed, 3 Jan 2018 05:41:47 +0000 (00:41 -0500)
For dentry operations that cover multiple dentry aliases of
a single inode, create a compatibility wrapper to hide differences
between the older dget_locked() and the current dget().

No functional change should be incurred by this commit.

Reviewed-on: https://gerrit.openafs.org/12789
Reviewed-by: Andrew Deason <adeason@dson.org>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 74f4bfc627c836c12bb7c188b86d570d2afdcae8)

Change-Id: Id854e5957547a1370cadb400f7f699c30d861fd1
Reviewed-on: https://gerrit.openafs.org/12847
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/afs/LINUX/osi_compat.h
src/afs/LINUX/osi_vcache.c
src/afs/LINUX/osi_vnodeops.c

index 2c93d2204ea1190edcc7ede838b87210b54960cb..7ed4d057edc5a89df1382718913d0890a103b950 100644 (file)
@@ -471,6 +471,21 @@ afs_linux_unlock_inode(struct inode *ip) {
 #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
+ * inode->i_lock) is already held.
+ */
+static inline void
+afs_linux_dget(struct dentry *dp) {
+#if defined(HAVE_DCACHE_LOCK)
+    dget_locked(dp);
+#else
+    dget(dp);
+#endif
+}
+
+
 static inline int
 afs_inode_setattr(struct osi_file *afile, struct iattr *newattrs) {
 
index bc74b674432d144773618887605660587e0bb9a7..e4639717cef91431abc8347de628f3d0fb002fca 100644 (file)
@@ -31,7 +31,7 @@ restart:
     list_for_each_entry(dentry, &inode->i_dentry, d_alias) {
        if (d_unhashed(dentry))
            continue;
-       dget_locked(dentry);
+       afs_linux_dget(dentry);
 
        spin_unlock(&dcache_lock);
        if (d_invalidate(dentry) == -EBUSY) {
@@ -63,7 +63,7 @@ restart:
            continue;
        }
        spin_unlock(&dentry->d_lock);
-       dget(dentry);
+       afs_linux_dget(dentry);
 
        spin_unlock(&inode->i_lock);
        if (afs_d_invalidate(dentry) == -EBUSY) {
index 5e2818bcaba2e1f872ee76ae06041dc551611105..3bb2f7601c35bea768125030e078fbe0a9383f74 100644 (file)
@@ -923,12 +923,12 @@ canonical_dentry(struct inode *ip)
 
 # ifdef HAVE_DCACHE_LOCK
     if (ret) {
-       dget_locked(ret);
+       afs_linux_dget(ret);
     }
     spin_unlock(&dcache_lock);
 # else
     if (ret) {
-       dget(ret);
+       afs_linux_dget(ret);
     }
     spin_unlock(&ip->i_lock);
 # endif