LINUX: create afs_linux_dget() compat wrapper 89/12789/5
authorMark Vitale <mvitale@sinenomine.net>
Thu, 30 Nov 2017 21:08:38 +0000 (16:08 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Mon, 1 Jan 2018 22:42:57 +0000 (17:42 -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.

Change-Id: I2bb0d453417f37707018f6ba5859903c3d34c8ff
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>

src/afs/LINUX/osi_compat.h
src/afs/LINUX/osi_vcache.c
src/afs/LINUX/osi_vnodeops.c

index 2c93d22..7ed4d05 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 bc74b67..e463971 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 5e2818b..3bb2f76 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