diff options
author | Brian Behlendorf <[email protected]> | 2018-05-02 15:01:24 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2018-05-02 15:01:24 -0700 |
commit | 9464b9591ea5cd61a4d6ef8e29c4597b48d16a77 (patch) | |
tree | 549b75c9d264a4b1da403268ccbb49f20e4ef4e6 /config/kernel-vfs-iterate.m4 | |
parent | bc8a6a60e9f0fd219e10f355384d87a41d4f5882 (diff) |
RHEL 7.5 compat: FMODE_KABI_ITERATE
As of RHEL 7.5 the mainline fops.iterate() method was added to
the file_operations structure and is correctly detected by the
configure script.
Normally this is what we want, but in order to maintain KABI
compatibility the RHEL change additionally does the following:
* Requires that callers intending to use this extended interface
set the FMODE_KABI_ITERATE flag on the file structure when
opening the directory.
* Adds the fops.iterate() method to the end of the structure,
without removing fops.readdir().
This change updates the configure check to ignore the RHEL 7.5+
variant of fops.iterate() when detected. Instead fallback to
the fops.readdir() interface which will be available.
Finally, add the 'zpl_' prefix to the directory context wrappers
to avoid colliding with the kernel provided symbols when both
the fops.iterate() and fops.readdir() are provided by the kernel.
Reviewed-by: Olaf Faaland <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #7460
Closes #7463
Diffstat (limited to 'config/kernel-vfs-iterate.m4')
-rw-r--r-- | config/kernel-vfs-iterate.m4 | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/config/kernel-vfs-iterate.m4 b/config/kernel-vfs-iterate.m4 index 7b1599e13..5de901d44 100644 --- a/config/kernel-vfs-iterate.m4 +++ b/config/kernel-vfs-iterate.m4 @@ -23,16 +23,27 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_ITERATE], [ dnl # dnl # 3.11 API change dnl # + dnl # RHEL 7.5 compatibility; the fops.iterate() method was + dnl # added to the file_operations structure but in order to + dnl # maintain KABI compatibility all callers must set + dnl # FMODE_KABI_ITERATE which is checked in iterate_dir(). + dnl # When detected ignore this interface and fallback to + dnl # to using fops.readdir() to retain KABI compatibility. + dnl # AC_MSG_CHECKING([whether fops->iterate() is available]) ZFS_LINUX_TRY_COMPILE([ #include <linux/fs.h> - int iterate(struct file *filp, struct dir_context * context) - { return 0; } + int iterate(struct file *filp, + struct dir_context *context) { return 0; } static const struct file_operations fops __attribute__ ((unused)) = { .iterate = iterate, }; + + #if defined(FMODE_KABI_ITERATE) + #error "RHEL 7.5, FMODE_KABI_ITERATE interface" + #endif ],[ ],[ AC_MSG_RESULT(yes) @@ -44,8 +55,8 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_ITERATE], [ AC_MSG_CHECKING([whether fops->readdir() is available]) ZFS_LINUX_TRY_COMPILE([ #include <linux/fs.h> - int readdir(struct file *filp, void *entry, filldir_t func) - { return 0; } + int readdir(struct file *filp, void *entry, + filldir_t func) { return 0; } static const struct file_operations fops __attribute__ ((unused)) = { @@ -57,7 +68,7 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_ITERATE], [ AC_DEFINE(HAVE_VFS_READDIR, 1, [fops->readdir() is available]) ],[ - AC_MSG_ERROR(no; file a bug report with ZFSOnLinux) + AC_MSG_ERROR(no; file a bug report with ZoL) ]) ]) ]) |