summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2015-07-15 10:54:26 -0700
committerBrian Behlendorf <[email protected]>2015-07-17 09:18:16 -0700
commitbd29109f1ac5be68f7f7c8bcb49e1b706fe899f0 (patch)
tree6aa5f76ed5f9748ffbb8949b752826001c9fbb1e /config
parent7eb333fbdde32dbebdcc88c35610159e207237c9 (diff)
Linux 4.2 compat: follow_link() / put_link()
As of Linux 4.2 the kernel has completely retired the nameidata structure. One of the few remaining consumers of this interface were the follow_link() and put_link() callbacks. This patch adds the required checks to configure to detect the interface change and updates the functions accordingly. Migrating to the simple_follow_link() interface was considered but was decided against ironically due to the increased complexity. It also should be noted that the kernel follow_link() and put_link() interfaces changes several times after 4.1 and but before 4.2. This means there is a narrow range of kernel commits which never appear in an official tag of the Linux kernel which ZoL will not build. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Yao <[email protected]> Issue #3596
Diffstat (limited to 'config')
-rw-r--r--config/kernel-create-nameidata.m44
-rw-r--r--config/kernel-follow-link-nameidata.m424
-rw-r--r--config/kernel-lookup-nameidata.m44
-rw-r--r--config/kernel-put-link-nameidata.m423
-rw-r--r--config/kernel.m42
5 files changed, 53 insertions, 4 deletions
diff --git a/config/kernel-create-nameidata.m4 b/config/kernel-create-nameidata.m4
index 9aad46fec..a71490a00 100644
--- a/config/kernel-create-nameidata.m4
+++ b/config/kernel-create-nameidata.m4
@@ -2,7 +2,7 @@ dnl #
dnl # 3.6 API change
dnl #
AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [
- AC_MSG_CHECKING([whether iops->create() takes struct nameidata])
+ AC_MSG_CHECKING([whether iops->create() passes nameidata])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
@@ -22,7 +22,7 @@ AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CREATE_NAMEIDATA, 1,
- [iops->create() operation takes nameidata])
+ [iops->create() passes nameidata])
],[
AC_MSG_RESULT(no)
])
diff --git a/config/kernel-follow-link-nameidata.m4 b/config/kernel-follow-link-nameidata.m4
new file mode 100644
index 000000000..88c85accb
--- /dev/null
+++ b/config/kernel-follow-link-nameidata.m4
@@ -0,0 +1,24 @@
+dnl #
+dnl # 4.2 API change
+dnl # This kernel retired the nameidata structure which forced the
+dnl # restructuring of the follow_link() prototype and how it is called.
+dnl # We check for the new interface rather than detecting the old one.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_FOLLOW_LINK], [
+ AC_MSG_CHECKING([whether iops->follow_link() passes nameidata])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ const char *follow_link(struct dentry *de, void **cookie)
+ { return "symlink"; }
+ static struct inode_operations iops __attribute__ ((unused)) = {
+ .follow_link = follow_link,
+ };
+ ],[
+ ],[
+ AC_MSG_RESULT(no)
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_FOLLOW_LINK_NAMEIDATA, 1,
+ [iops->follow_link() nameidata])
+ ])
+])
diff --git a/config/kernel-lookup-nameidata.m4 b/config/kernel-lookup-nameidata.m4
index 645560398..43f5fb4cb 100644
--- a/config/kernel-lookup-nameidata.m4
+++ b/config/kernel-lookup-nameidata.m4
@@ -2,7 +2,7 @@ dnl #
dnl # 3.6 API change
dnl #
AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [
- AC_MSG_CHECKING([whether iops->lookup() takes struct nameidata])
+ AC_MSG_CHECKING([whether iops->lookup() passes nameidata])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
@@ -18,7 +18,7 @@ AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LOOKUP_NAMEIDATA, 1,
- [iops->lookup() operation takes nameidata])
+ [iops->lookup() passes nameidata])
],[
AC_MSG_RESULT(no)
])
diff --git a/config/kernel-put-link-nameidata.m4 b/config/kernel-put-link-nameidata.m4
new file mode 100644
index 000000000..0181ae515
--- /dev/null
+++ b/config/kernel-put-link-nameidata.m4
@@ -0,0 +1,23 @@
+dnl #
+dnl # 4.2 API change
+dnl # This kernel retired the nameidata structure which forced the
+dnl # restructuring of the put_link() prototype and how it is called.
+dnl # We check for the new interface rather than detecting the old one.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_PUT_LINK], [
+ AC_MSG_CHECKING([whether iops->put_link() passes nameidata])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ void put_link(struct inode *ip, void *cookie) { return; }
+ static struct inode_operations iops __attribute__ ((unused)) = {
+ .put_link = put_link,
+ };
+ ],[
+ ],[
+ AC_MSG_RESULT(no)
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_PUT_LINK_NAMEIDATA, 1,
+ [iops->put_link() nameidata])
+ ])
+])
diff --git a/config/kernel.m4 b/config/kernel.m4
index 806c5747a..5c97659c7 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -70,6 +70,8 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_MKDIR_UMODE_T
ZFS_AC_KERNEL_LOOKUP_NAMEIDATA
ZFS_AC_KERNEL_CREATE_NAMEIDATA
+ ZFS_AC_KERNEL_FOLLOW_LINK
+ ZFS_AC_KERNEL_PUT_LINK
ZFS_AC_KERNEL_TRUNCATE_RANGE
ZFS_AC_KERNEL_AUTOMOUNT
ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE