From c761f248397334400f8b4bb71cc4d01d3e4fc6ff Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Tue, 20 May 2008 22:02:49 +0000 Subject: [PATCH] linux-hlist-unhashed-opencoding-20080520 LICENSE IPL10 FIXES 93871 if we can't use hlist_unhashed (which is dumb) or we don't have it (less dumb) work around it. ==================== This delta was composed from multiple commits as part of the CVS->Git migration. The checkin message with each commit was inconsistent. The following are the additional commit messages. ==================== LICENSE IPL10 FIXES 93871 if we can't use hlist_unhashed (which is dumb) or we don't have it (less dumb) w ork around it. --- acinclude.m4 | 4 ++++ src/afs/LINUX/osi_vnodeops.c | 10 +++++++++- src/cf/linux-test4.m4 | 12 ++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 8d54456ca5..ed5f9a9f35 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -645,6 +645,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) LINUX_KERNEL_SELINUX LINUX_KERNEL_SOCK_CREATE LINUX_KERNEL_PAGE_FOLLOW_LINK + LINUX_KERNEL_HLIST_UNHASHED LINUX_KEY_TYPE_H_EXISTS LINUX_NEED_RHCONFIG LINUX_RECALC_SIGPENDING_ARG_TYPE @@ -823,6 +824,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) if test "x$ac_cv_linux_kernel_page_follow_link" = "xyes" ; then AC_DEFINE(HAVE_KERNEL_PAGE_FOLLOW_LINK, 1, [define if your linux kernel provides page_follow_link]) fi + if test "x$ac_cv_linux_kernel_page_follow_link" = "xyes" ; then + AC_DEFINE(HAVE_KERNEL_HLIST_UNHASHED, 1, [define if your linux kernel provides hlist_unhashed]) + fi if test "x$ac_linux_syscall" = "xyes" ; then AC_DEFINE(HAVE_KERNEL_LINUX_SYSCALL_H, 1, [define if your linux kernel has linux/syscall.h]) fi diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 6a324c880a..94b386c23c 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1033,7 +1033,15 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp) ip = AFSTOV(vcp); afs_getattr(vcp, &vattr, credp); afs_fill_inode(ip, &vattr); - if (hlist_unhashed(&ip->i_hash)) + if ( +#ifdef HAVE_KERNEL_HLIST_UNHASHED + hlist_unhashed(&ip->i_hash) +#elif defined(AFS_LINUX26_ENV) + ip->i_hash.pprev == NULL +#else + ip->i_hash.prev == NULL +#endif + ) insert_inode_hash(ip); } dp->d_op = &afs_dentry_operations; diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index 448d55143b..f14d5f8e76 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -511,6 +511,18 @@ AC_DEFUN([LINUX_KERNEL_PAGE_FOLLOW_LINK], [ CPPFLAGS="$save_CPPFLAGS"]) AC_MSG_RESULT($ac_cv_linux_kernel_page_follow_link)]) +AC_DEFUN([LINUX_KERNEL_HLIST_UNHASHED], [ + AC_MSG_CHECKING([for hlist_unhashed]) + AC_CACHE_VAL([ac_cv_linux_kernel_hlist_unhashed], [ + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration" + AC_TRY_KBUILD( +[#include ], +[hlist_unhashed(0);], + ac_cv_linux_kernel_hlist_unhashed=yes, + ac_cv_linux_kernel_hlist_unhashed=no) + CPPFLAGS="$save_CPPFLAGS"]) + AC_MSG_RESULT($ac_cv_linux_kernel_hlist_unhashed)]) AC_DEFUN([LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_GFP_MASK], [ AC_MSG_CHECKING([for gfp_mask in struct address_space])