From a42f01d5ebb13da575b3123800ee6990743155ab Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Thu, 23 Oct 2014 11:12:57 -0400 Subject: [PATCH] Linux 3.18: d_invalidate can no longer return an error d_invalidate is now defined as void and does not have a return value to check. Change-Id: Ief1b562db63877dde9f4a8ac4918b727a05b23bb Reviewed-on: http://gerrit.openafs.org/11562 Tested-by: BuildBot Reviewed-by: D Brashear --- acinclude.m4 | 1 + src/afs/LINUX/osi_compat.h | 11 +++++++++++ src/afs/LINUX/osi_vcache.c | 4 +++- src/cf/linux-test4.m4 | 13 +++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 7040e19ee..549eea3d3 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1073,6 +1073,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) LINUX_IOP_I_CREATE_TAKES_BOOL LINUX_DOP_D_REVALIDATE_TAKES_UNSIGNED LINUX_IOP_LOOKUP_TAKES_UNSIGNED + LINUX_D_INVALIDATE_IS_VOID dnl If we are guaranteed that keyrings will work - that is dnl a) The kernel has keyrings enabled diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h index e9e5076da..57f6ea773 100644 --- a/src/afs/LINUX/osi_compat.h +++ b/src/afs/LINUX/osi_compat.h @@ -610,4 +610,15 @@ afs_maybe_shrink_dcache(struct dentry *dp) #endif } +static inline int +afs_d_invalidate(struct dentry *dp) +{ +#if defined(D_INVALIDATE_IS_VOID) + d_invalidate(dp); + return 0; +#else + return d_invalidate(dp); +#endif +} + #endif /* AFS_LINUX_OSI_COMPAT_H */ diff --git a/src/afs/LINUX/osi_vcache.c b/src/afs/LINUX/osi_vcache.c index 99aab919d..1d0db82cc 100644 --- a/src/afs/LINUX/osi_vcache.c +++ b/src/afs/LINUX/osi_vcache.c @@ -13,6 +13,8 @@ #include "afs/sysincludes.h" /*Standard vendor system headers */ #include "afsincludes.h" /*AFS-based standard headers */ +#include "osi_compat.h" + int osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { int code; @@ -71,7 +73,7 @@ restart: dget(dentry); spin_unlock(&inode->i_lock); - if (d_invalidate(dentry) == -EBUSY) { + if (afs_d_invalidate(dentry) == -EBUSY) { dput(dentry); /* perhaps lock and try to continue? (use cur as head?) */ goto inuse; diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index 228b4913f..f0269b380 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -776,3 +776,16 @@ AC_DEFUN([LINUX_IOP_LOOKUP_TAKES_UNSIGNED], [ [define if your iops.lookup takes an unsigned int argument], [-Werror]) ]) + + +AC_DEFUN([LINUX_D_INVALIDATE_IS_VOID], [ + AC_CHECK_LINUX_BUILD([whether d_invalidate returns void], + [ac_cv_linux_func_d_invalidate_returns_void], + [#include ], + [ + void d_invalidate(struct dentry *); + ], + [D_INVALIDATE_IS_VOID], + [define if your d_invalidate returns void], + []) +]) -- 2.39.5