DEVEL15-linux-hlist-unhashed-opencoding-20080520
authorDerrick Brashear <shadow@dementia.org>
Tue, 20 May 2008 22:03:20 +0000 (22:03 +0000)
committerDerrick Brashear <shadow@dementia.org>
Tue, 20 May 2008 22:03:20 +0000 (22:03 +0000)
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.

(cherry picked from commit c761f248397334400f8b4bb71cc4d01d3e4fc6ff)

acinclude.m4
src/afs/LINUX/osi_vnodeops.c
src/cf/linux-test4.m4

index 36df230..65808c0 100644 (file)
@@ -660,6 +660,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
@@ -838,6 +839,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
index 4b12d6d..ef57f2e 100644 (file)
@@ -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;
index 448d551..f14d5f8 100644 (file)
@@ -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 <linux/list.h>],
+[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])