From: Mark Vitale Date: Thu, 30 Nov 2017 21:08:38 +0000 (-0500) Subject: LINUX: create afs_linux_dget() compat wrapper X-Git-Tag: upstream/1.8.0_pre4^3~6 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=0ec02ef73d7b94bbe83e7532524c096799cd4b25;p=packages%2Fo%2Fopenafs.git LINUX: create afs_linux_dget() compat wrapper 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 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit 74f4bfc627c836c12bb7c188b86d570d2afdcae8) Change-Id: Id854e5957547a1370cadb400f7f699c30d861fd1 Reviewed-on: https://gerrit.openafs.org/12847 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h index 2c93d2204..7ed4d057e 100644 --- a/src/afs/LINUX/osi_compat.h +++ b/src/afs/LINUX/osi_compat.h @@ -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) { diff --git a/src/afs/LINUX/osi_vcache.c b/src/afs/LINUX/osi_vcache.c index bc74b6744..e4639717c 100644 --- a/src/afs/LINUX/osi_vcache.c +++ b/src/afs/LINUX/osi_vcache.c @@ -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) { diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 5e2818bca..3bb2f7601 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -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