overlayfs: make mcoverlayfs compile for 4.14.0-115 (el7 arm64)
Use the 4.18 module as a base Change-Id: I6c9ef66399800828e1932573da5a97573545c5da
This commit is contained in:
3
configure
vendored
3
configure
vendored
@@ -4766,6 +4766,9 @@ EOF
|
|||||||
MCOVERLAYFS_MODULE=linux-3.10.0-327.36.1.el7;;
|
MCOVERLAYFS_MODULE=linux-3.10.0-327.36.1.el7;;
|
||||||
262144) # 4.0.0
|
262144) # 4.0.0
|
||||||
MCOVERLAYFS_MODULE=linux-4.0.9;;
|
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
|
266752) # 4.18.0
|
||||||
MCOVERLAYFS_MODULE=linux-4.18.14;;
|
MCOVERLAYFS_MODULE=linux-4.18.14;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -465,6 +465,9 @@ EOF
|
|||||||
MCOVERLAYFS_MODULE=linux-3.10.0-327.36.1.el7;;
|
MCOVERLAYFS_MODULE=linux-3.10.0-327.36.1.el7;;
|
||||||
262144) # 4.0.0
|
262144) # 4.0.0
|
||||||
MCOVERLAYFS_MODULE=linux-4.0.9;;
|
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
|
266752) # 4.18.0
|
||||||
MCOVERLAYFS_MODULE=linux-4.18.14;;
|
MCOVERLAYFS_MODULE=linux-4.18.14;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <linux/posix_acl_xattr.h>
|
#include <linux/posix_acl_xattr.h>
|
||||||
#include <linux/atomic.h>
|
#include <linux/atomic.h>
|
||||||
#include <linux/ratelimit.h>
|
#include <linux/ratelimit.h>
|
||||||
|
#include <linux/version.h>
|
||||||
#include "overlayfs.h"
|
#include "overlayfs.h"
|
||||||
|
|
||||||
static unsigned short ovl_redirect_max = 256;
|
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)
|
if (!inode)
|
||||||
goto out_drop_write;
|
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);
|
spin_lock(&inode->i_lock);
|
||||||
inode->i_state |= I_CREATING;
|
inode->i_state |= I_CREATING;
|
||||||
spin_unlock(&inode->i_lock);
|
spin_unlock(&inode->i_lock);
|
||||||
|
#endif
|
||||||
|
|
||||||
inode_init_owner(inode, dentry->d_parent->d_inode, mode);
|
inode_init_owner(inode, dentry->d_parent->d_inode, mode);
|
||||||
attr.mode = inode->i_mode;
|
attr.mode = inode->i_mode;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <linux/xattr.h>
|
#include <linux/xattr.h>
|
||||||
#include <linux/exportfs.h>
|
#include <linux/exportfs.h>
|
||||||
#include <linux/ratelimit.h>
|
#include <linux/ratelimit.h>
|
||||||
|
#include <linux/version.h>
|
||||||
#include "overlayfs.h"
|
#include "overlayfs.h"
|
||||||
|
|
||||||
static int ovl_encode_maybe_copy_up(struct dentry *dentry)
|
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;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
|
||||||
/*
|
/*
|
||||||
* Find or instantiate an overlay dentry from real dentries and index.
|
* 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);
|
WARN_ON_ONCE(1);
|
||||||
return ERR_PTR(-EIO);
|
return ERR_PTR(-EIO);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const struct export_operations ovl_export_operations = {
|
const struct export_operations ovl_export_operations = {
|
||||||
.encode_fh = ovl_encode_fh,
|
.encode_fh = ovl_encode_fh,
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
|
||||||
.fh_to_dentry = ovl_fh_to_dentry,
|
.fh_to_dentry = ovl_fh_to_dentry,
|
||||||
.fh_to_parent = ovl_fh_to_parent,
|
.fh_to_parent = ovl_fh_to_parent,
|
||||||
.get_name = ovl_get_name,
|
.get_name = ovl_get_name,
|
||||||
.get_parent = ovl_get_parent,
|
.get_parent = ovl_get_parent,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <linux/xattr.h>
|
#include <linux/xattr.h>
|
||||||
#include <linux/posix_acl.h>
|
#include <linux/posix_acl.h>
|
||||||
#include <linux/ratelimit.h>
|
#include <linux/ratelimit.h>
|
||||||
|
#include <linux/version.h>
|
||||||
#include "overlayfs.h"
|
#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,
|
static struct inode *ovl_iget5(struct super_block *sb, struct inode *newinode,
|
||||||
struct inode *key)
|
struct inode *key)
|
||||||
{
|
{
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
|
||||||
return newinode ? inode_insert5(newinode, (unsigned long) key,
|
return newinode ? inode_insert5(newinode, (unsigned long) key,
|
||||||
ovl_inode_test, ovl_inode_set, key) :
|
ovl_inode_test, ovl_inode_set, key) :
|
||||||
|
#else
|
||||||
|
return
|
||||||
|
#endif
|
||||||
iget5_locked(sb, (unsigned long) key,
|
iget5_locked(sb, (unsigned long) key,
|
||||||
ovl_inode_test, ovl_inode_set, key);
|
ovl_inode_test, ovl_inode_set, key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
#include <linux/ratelimit.h>
|
#include <linux/ratelimit.h>
|
||||||
#include <linux/mount.h>
|
#include <linux/mount.h>
|
||||||
#include <linux/exportfs.h>
|
#include <linux/exportfs.h>
|
||||||
|
#include <linux/version.h>
|
||||||
|
#include <linux/kallsyms.h>
|
||||||
#include "overlayfs.h"
|
#include "overlayfs.h"
|
||||||
|
|
||||||
struct ovl_lookup_data {
|
struct ovl_lookup_data {
|
||||||
@@ -94,6 +96,10 @@ invalid:
|
|||||||
|
|
||||||
static int ovl_acceptable(void *ctx, struct dentry *dentry)
|
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
|
* A non-dir origin may be disconnected, which is fine, because
|
||||||
* we only need it for its unique inode number.
|
* 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))
|
if (d_unhashed(dentry))
|
||||||
return 0;
|
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 */
|
/* Check if directory belongs to the layer we are decoding from */
|
||||||
return is_subdir(dentry, ((struct vfsmount *)ctx)->mnt_root);
|
return is_subdir(dentry, ((struct vfsmount *)ctx)->mnt_root);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include <linux/seq_file.h>
|
#include <linux/seq_file.h>
|
||||||
#include <linux/posix_acl_xattr.h>
|
#include <linux/posix_acl_xattr.h>
|
||||||
#include <linux/exportfs.h>
|
#include <linux/exportfs.h>
|
||||||
|
#include <linux/version.h>
|
||||||
#include "overlayfs.h"
|
#include "overlayfs.h"
|
||||||
|
|
||||||
MODULE_AUTHOR("Miklos Szeredi <miklos@szeredi.hu>");
|
MODULE_AUTHOR("Miklos Szeredi <miklos@szeredi.hu>");
|
||||||
@@ -726,7 +727,11 @@ static int ovl_mount_dir_noesc(const char *name, struct path *path)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_put:
|
out_put:
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
|
||||||
path_put_init(path);
|
path_put_init(path);
|
||||||
|
#else
|
||||||
|
path_put(path);
|
||||||
|
#endif
|
||||||
out:
|
out:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -744,7 +749,11 @@ static int ovl_mount_dir(const char *name, struct path *path)
|
|||||||
if (ovl_dentry_remote(path->dentry)) {
|
if (ovl_dentry_remote(path->dentry)) {
|
||||||
pr_err("overlayfs: filesystem on '%s' not supported as upperdir\n",
|
pr_err("overlayfs: filesystem on '%s' not supported as upperdir\n",
|
||||||
tmp);
|
tmp);
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
|
||||||
path_put_init(path);
|
path_put_init(path);
|
||||||
|
#else
|
||||||
|
path_put(path);
|
||||||
|
#endif
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
}
|
}
|
||||||
kfree(tmp);
|
kfree(tmp);
|
||||||
@@ -805,7 +814,11 @@ static int ovl_lower_dir(const char *name, struct path *path,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_put:
|
out_put:
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
|
||||||
path_put_init(path);
|
path_put_init(path);
|
||||||
|
#else
|
||||||
|
path_put(path);
|
||||||
|
#endif
|
||||||
out:
|
out:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user