mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-30 10:44:09 +03:00
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 <faaland1@llnl.gov> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #7460 Closes #7463
This commit is contained in:
@@ -76,7 +76,7 @@ zpl_release(struct inode *ip, struct file *filp)
|
||||
}
|
||||
|
||||
static int
|
||||
zpl_iterate(struct file *filp, struct dir_context *ctx)
|
||||
zpl_iterate(struct file *filp, zpl_dir_context_t *ctx)
|
||||
{
|
||||
cred_t *cr = CRED();
|
||||
int error;
|
||||
@@ -96,7 +96,8 @@ zpl_iterate(struct file *filp, struct dir_context *ctx)
|
||||
static int
|
||||
zpl_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
{
|
||||
struct dir_context ctx = DIR_CONTEXT_INIT(dirent, filldir, filp->f_pos);
|
||||
zpl_dir_context_t ctx =
|
||||
ZPL_DIR_CONTEXT_INIT(dirent, filldir, filp->f_pos);
|
||||
int error;
|
||||
|
||||
error = zpl_iterate(filp, &ctx);
|
||||
@@ -104,7 +105,7 @@ zpl_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
|
||||
return (error);
|
||||
}
|
||||
#endif /* HAVE_VFS_ITERATE */
|
||||
#endif /* !HAVE_VFS_ITERATE && !HAVE_VFS_ITERATE_SHARED */
|
||||
|
||||
#if defined(HAVE_FSYNC_WITH_DENTRY)
|
||||
/*
|
||||
@@ -965,7 +966,7 @@ const struct file_operations zpl_file_operations = {
|
||||
const struct file_operations zpl_dir_file_operations = {
|
||||
.llseek = generic_file_llseek,
|
||||
.read = generic_read_dir,
|
||||
#ifdef HAVE_VFS_ITERATE_SHARED
|
||||
#if defined(HAVE_VFS_ITERATE_SHARED)
|
||||
.iterate_shared = zpl_iterate,
|
||||
#elif defined(HAVE_VFS_ITERATE)
|
||||
.iterate = zpl_iterate,
|
||||
|
||||
Reference in New Issue
Block a user