Linux 4.5: get_link instead of follow_link+put_link 65/12265/7
authorChaskiel Grundman <cg2v@andrew.cmu.edu>
Thu, 5 May 2016 16:35:08 +0000 (12:35 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 10 Jun 2016 20:21:05 +0000 (16:21 -0400)
In linux commit 6b255391, the follow_link inode operation was
replaced by the get_link operation, which is basically the same
but takes the inode and dentry separately, allowing for the
possibility of staying in RCU mode.

For now, only support this if page_get_link is available and we are
using the USABLE_KERNEL_PAGE_SYMLINK_CACHE

The previous test for USABLE_KERNEL_PAGE_SYMLINK_CACHE used a bogus,
undefined configure variable (ac_cv_linux_kernel_page_follow_link).
Remove it, as it was not needed

Change-Id: I2d7851d31dd4b1b944b16fad611addb804930eca
Reviewed-on: https://gerrit.openafs.org/12265
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Tested-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

acinclude.m4
src/afs/LINUX/osi_vnodeops.c

index f215319..44082c2 100644 (file)
@@ -947,6 +947,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h])
                 AC_CHECK_LINUX_STRUCT([file_system_type], [mount], [fs.h])
                 AC_CHECK_LINUX_STRUCT([inode_operations], [truncate], [fs.h])
+                AC_CHECK_LINUX_STRUCT([inode_operations], [get_link], [fs.h])
                 AC_CHECK_LINUX_STRUCT([key], [payload.value], [key.h])
                 AC_CHECK_LINUX_STRUCT([key_type], [instantiate_prep], [key-type.h])
                 AC_CHECK_LINUX_STRUCT([key_type], [match_preparse], [key-type.h])
@@ -1047,6 +1048,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 AC_CHECK_LINUX_FUNC([page_follow_link],
                                     [#include <linux/fs.h>],
                                     [page_follow_link(0,0);])
+                AC_CHECK_LINUX_FUNC([page_get_link],
+                                    [#include <linux/fs.h>],
+                                    [page_get_link(0,0,0);])
                 AC_CHECK_LINUX_FUNC([page_offset],
                                     [#include <linux/pagemap.h>],
                                     [page_offset(NULL);])
@@ -1224,11 +1228,15 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 if test -f "$LINUX_KERNEL_PATH/include/linux/mm_inline.h"; then
                  AC_DEFINE(HAVE_MM_INLINE_H, 1, [define if you have mm_inline.h header file])
                 fi
-                if test "x$ac_cv_linux_kernel_page_follow_link" = "xyes" -o "x$ac_cv_linux_func_i_put_link_takes_cookie" = "xyes"; then
+                if test "x$ac_cv_linux_func_page_get_link" = "xyes" -o "x$ac_cv_linux_func_i_put_link_takes_cookie" = "xyes"; then
                  AC_DEFINE(USABLE_KERNEL_PAGE_SYMLINK_CACHE, 1, [define if your kernel has a usable symlink cache API])
                 else
                  AC_MSG_WARN([your kernel does not have a usable symlink cache API])
                 fi
+                if test "x$ac_cv_linux_func_page_get_link" != "xyes" -a "x$ac_cv_linux_struct_inode_operations_has_get_link" = "xyes"; then
+                       AC_MSG_ERROR([Your kernel does not use follow_link - not supported without symlink cache API])
+                       exit 1
+                fi
                 :
                fi
                if test "x$enable_linux_d_splice_alias_extra_iput" = xyes; then
index 6a8e95b..a82464c 100644 (file)
@@ -3114,7 +3114,9 @@ static struct address_space_operations afs_symlink_aops = {
 static struct inode_operations afs_symlink_iops = {
 #if defined(USABLE_KERNEL_PAGE_SYMLINK_CACHE)
   .readlink =          page_readlink,
-# if defined(HAVE_LINUX_PAGE_FOLLOW_LINK)
+# if defined(HAVE_LINUX_PAGE_GET_LINK)
+  .get_link =          page_get_link,
+# elif defined(HAVE_LINUX_PAGE_FOLLOW_LINK)
   .follow_link =       page_follow_link,
 # else
   .follow_link =       page_follow_link_light,