diff --git a/configure b/configure index 1c07683c..a82b8b27 100755 --- a/configure +++ b/configure @@ -4766,6 +4766,9 @@ EOF MCOVERLAYFS_MODULE=linux-3.10.0-327.36.1.el7;; 262144) # 4.0.0 MCOVERLAYFS_MODULE=linux-4.0.9;; + 265728) # 4.14.0 + #MCOVERLAYFS_MODULE=linux-4.14.0-115.2.2.el7a;; + MCOVERLAYFS_MODULE=linux-4.18.14;; 266752) # 4.18.0 MCOVERLAYFS_MODULE=linux-4.18.14;; *) diff --git a/configure.ac b/configure.ac index 2143e8ca..36fb8065 100644 --- a/configure.ac +++ b/configure.ac @@ -465,6 +465,9 @@ EOF MCOVERLAYFS_MODULE=linux-3.10.0-327.36.1.el7;; 262144) # 4.0.0 MCOVERLAYFS_MODULE=linux-4.0.9;; + 265728) # 4.14.0 + #MCOVERLAYFS_MODULE=linux-4.14.0-115.2.2.el7a;; + MCOVERLAYFS_MODULE=linux-4.18.14;; 266752) # 4.18.0 MCOVERLAYFS_MODULE=linux-4.18.14;; *) diff --git a/executer/kernel/mcoverlayfs/linux-4.18.14/dir.c b/executer/kernel/mcoverlayfs/linux-4.18.14/dir.c index da9b3ccf..315e67a2 100644 --- a/executer/kernel/mcoverlayfs/linux-4.18.14/dir.c +++ b/executer/kernel/mcoverlayfs/linux-4.18.14/dir.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "overlayfs.h" static unsigned short ovl_redirect_max = 256; @@ -601,9 +602,12 @@ static int ovl_create_object(struct dentry *dentry, int mode, dev_t rdev, if (!inode) goto out_drop_write; +//normally added in 4.19, but rhel backported so lazy choice +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) spin_lock(&inode->i_lock); inode->i_state |= I_CREATING; spin_unlock(&inode->i_lock); +#endif inode_init_owner(inode, dentry->d_parent->d_inode, mode); attr.mode = inode->i_mode; diff --git a/executer/kernel/mcoverlayfs/linux-4.18.14/export.c b/executer/kernel/mcoverlayfs/linux-4.18.14/export.c index 9941ece6..b8718c9f 100644 --- a/executer/kernel/mcoverlayfs/linux-4.18.14/export.c +++ b/executer/kernel/mcoverlayfs/linux-4.18.14/export.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "overlayfs.h" static int ovl_encode_maybe_copy_up(struct dentry *dentry) @@ -287,6 +288,7 @@ static int ovl_encode_fh(struct inode *inode, u32 *fid, int *max_len, return type; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) /* * Find or instantiate an overlay dentry from real dentries and index. */ @@ -838,11 +840,14 @@ static struct dentry *ovl_get_parent(struct dentry *dentry) WARN_ON_ONCE(1); return ERR_PTR(-EIO); } +#endif const struct export_operations ovl_export_operations = { .encode_fh = ovl_encode_fh, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) .fh_to_dentry = ovl_fh_to_dentry, .fh_to_parent = ovl_fh_to_parent, .get_name = ovl_get_name, .get_parent = ovl_get_parent, +#endif }; diff --git a/executer/kernel/mcoverlayfs/linux-4.18.14/inode.c b/executer/kernel/mcoverlayfs/linux-4.18.14/inode.c index 203f6ded..c0a8872b 100644 --- a/executer/kernel/mcoverlayfs/linux-4.18.14/inode.c +++ b/executer/kernel/mcoverlayfs/linux-4.18.14/inode.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "overlayfs.h" @@ -778,8 +779,12 @@ static bool ovl_hash_bylower(struct super_block *sb, struct dentry *upper, static struct inode *ovl_iget5(struct super_block *sb, struct inode *newinode, struct inode *key) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) return newinode ? inode_insert5(newinode, (unsigned long) key, ovl_inode_test, ovl_inode_set, key) : +#else + return +#endif iget5_locked(sb, (unsigned long) key, ovl_inode_test, ovl_inode_set, key); } diff --git a/executer/kernel/mcoverlayfs/linux-4.18.14/namei.c b/executer/kernel/mcoverlayfs/linux-4.18.14/namei.c index c2229f02..4408f051 100644 --- a/executer/kernel/mcoverlayfs/linux-4.18.14/namei.c +++ b/executer/kernel/mcoverlayfs/linux-4.18.14/namei.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include "overlayfs.h" struct ovl_lookup_data { @@ -94,6 +96,10 @@ invalid: static int ovl_acceptable(void *ctx, struct dentry *dentry) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0) + static bool (*is_subdir)(struct dentry *new_dentry, struct dentry *old_dentry); +#endif + /* * A non-dir origin may be disconnected, which is fine, because * we only need it for its unique inode number. @@ -105,6 +111,13 @@ static int ovl_acceptable(void *ctx, struct dentry *dentry) if (d_unhashed(dentry)) return 0; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0) + if (!is_subdir) { + is_subdir = (void *)kallsyms_lookup_name("is_subdir"); + WARN_ON(!is_subdir); + } +#endif + /* Check if directory belongs to the layer we are decoding from */ return is_subdir(dentry, ((struct vfsmount *)ctx)->mnt_root); } diff --git a/executer/kernel/mcoverlayfs/linux-4.18.14/super.c b/executer/kernel/mcoverlayfs/linux-4.18.14/super.c index f9a5a0bc..95447e68 100644 --- a/executer/kernel/mcoverlayfs/linux-4.18.14/super.c +++ b/executer/kernel/mcoverlayfs/linux-4.18.14/super.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "overlayfs.h" MODULE_AUTHOR("Miklos Szeredi "); @@ -726,7 +727,11 @@ static int ovl_mount_dir_noesc(const char *name, struct path *path) return 0; out_put: +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) path_put_init(path); +#else + path_put(path); +#endif out: return err; } @@ -744,7 +749,11 @@ static int ovl_mount_dir(const char *name, struct path *path) if (ovl_dentry_remote(path->dentry)) { pr_err("overlayfs: filesystem on '%s' not supported as upperdir\n", tmp); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) path_put_init(path); +#else + path_put(path); +#endif err = -EINVAL; } kfree(tmp); @@ -805,7 +814,11 @@ static int ovl_lower_dir(const char *name, struct path *path, return 0; out_put: +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) path_put_init(path); +#else + path_put(path); +#endif out: return err; }