From e26e693e58e830b21be225cc8a1729cfce4b489e Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Wed, 17 Oct 2018 10:53:15 +0900 Subject: [PATCH] mcoverlayfs: update and compile new overlayfs for 4.18 kernels This newer version is much simpler than the old ones: - the options are noop, this lets the code simplify all the allocating of a new option struct and passing it around - ovl_reset_ovl_entry was added and called all the time, but the mechanism that made this required is gone in this kernel version On the other hand, one new thing in this version: - newer kernel check the stacking depth of filesystems now, and we are reaching the default limit of two with our setup. Bump it to three here. Also, while we are here, make make fail if requested directory does not exist, instead of infinitely recurse into make modules in the mcoverlayfs directory... Change-Id: I45050d693a0aa6fd3027deaf417c29876ef6a1ea --- configure | 3 ++- configure.ac | 1 + executer/kernel/mcoverlayfs/Makefile.in | 12 +++++++---- .../mcoverlayfs/linux-4.18.14/copy_up.c | 3 +++ .../kernel/mcoverlayfs/linux-4.18.14/inode.c | 9 +++++++++ .../kernel/mcoverlayfs/linux-4.18.14/super.c | 20 ++++++++++++++----- .../kernel/mcoverlayfs/linux-4.18.14/util.c | 2 ++ 7 files changed, 40 insertions(+), 10 deletions(-) diff --git a/configure b/configure index d3c8138d..c9ab2f29 100755 --- a/configure +++ b/configure @@ -4887,7 +4887,7 @@ ac_config_headers="$ac_config_headers config.h" # POSTK_DEBUG_ARCH_DEP_37 # AC_CONFIG_FILES arch dependfiles separate -ac_config_files="$ac_config_files Makefile executer/user/Makefile executer/user/mcexec.1:executer/user/mcexec.1in executer/user/vmcore2mckdump executer/user/arch/$ARCH/Makefile executer/user/arch/x86_64/Makefile executer/kernel/mcctrl/Makefile executer/kernel/mcctrl/arch/$ARCH/Makefile executer/kernel/mcoverlayfs/Makefile executer/kernel/mcoverlayfs/linux-3.10.0-327.36.1.el7/Makefile executer/kernel/mcoverlayfs/linux-4.0.9/Makefile executer/kernel/mcoverlayfs/linux-4.6.7/Makefile executer/include/qlmpilib.h kernel/Makefile kernel/Makefile.build kernel/include/swapfmt.h arch/x86_64/tools/mcreboot-attached-mic.sh arch/x86_64/tools/mcshutdown-attached-mic.sh arch/x86_64/tools/mcreboot-builtin-x86.sh arch/x86_64/tools/mcreboot-smp-x86.sh arch/x86_64/tools/mcstop+release-smp-x86.sh arch/x86_64/tools/mcoverlay-destroy-smp-x86.sh arch/x86_64/tools/mcoverlay-create-smp-x86.sh arch/x86_64/tools/eclair-dump-backtrace.exp arch/x86_64/tools/mcshutdown-builtin-x86.sh arch/x86_64/tools/mcreboot.1:arch/x86_64/tools/mcreboot.1in arch/x86_64/tools/irqbalance_mck.service arch/x86_64/tools/irqbalance_mck.in tools/mcstat/mcstat.1:tools/mcstat/mcstat.1in tools/mcstat/Makefile" +ac_config_files="$ac_config_files Makefile executer/user/Makefile executer/user/mcexec.1:executer/user/mcexec.1in executer/user/vmcore2mckdump executer/user/arch/$ARCH/Makefile executer/user/arch/x86_64/Makefile executer/kernel/mcctrl/Makefile executer/kernel/mcctrl/arch/$ARCH/Makefile executer/kernel/mcoverlayfs/Makefile executer/kernel/mcoverlayfs/linux-3.10.0-327.36.1.el7/Makefile executer/kernel/mcoverlayfs/linux-4.0.9/Makefile executer/kernel/mcoverlayfs/linux-4.6.7/Makefile executer/kernel/mcoverlayfs/linux-4.18.14/Makefile executer/include/qlmpilib.h kernel/Makefile kernel/Makefile.build kernel/include/swapfmt.h arch/x86_64/tools/mcreboot-attached-mic.sh arch/x86_64/tools/mcshutdown-attached-mic.sh arch/x86_64/tools/mcreboot-builtin-x86.sh arch/x86_64/tools/mcreboot-smp-x86.sh arch/x86_64/tools/mcstop+release-smp-x86.sh arch/x86_64/tools/mcoverlay-destroy-smp-x86.sh arch/x86_64/tools/mcoverlay-create-smp-x86.sh arch/x86_64/tools/eclair-dump-backtrace.exp arch/x86_64/tools/mcshutdown-builtin-x86.sh arch/x86_64/tools/mcreboot.1:arch/x86_64/tools/mcreboot.1in arch/x86_64/tools/irqbalance_mck.service arch/x86_64/tools/irqbalance_mck.in tools/mcstat/mcstat.1:tools/mcstat/mcstat.1in tools/mcstat/Makefile" if test -e "${ABS_SRCDIR}/test"; then @@ -5613,6 +5613,7 @@ do "executer/kernel/mcoverlayfs/linux-3.10.0-327.36.1.el7/Makefile") CONFIG_FILES="$CONFIG_FILES executer/kernel/mcoverlayfs/linux-3.10.0-327.36.1.el7/Makefile" ;; "executer/kernel/mcoverlayfs/linux-4.0.9/Makefile") CONFIG_FILES="$CONFIG_FILES executer/kernel/mcoverlayfs/linux-4.0.9/Makefile" ;; "executer/kernel/mcoverlayfs/linux-4.6.7/Makefile") CONFIG_FILES="$CONFIG_FILES executer/kernel/mcoverlayfs/linux-4.6.7/Makefile" ;; + "executer/kernel/mcoverlayfs/linux-4.18.14/Makefile") CONFIG_FILES="$CONFIG_FILES executer/kernel/mcoverlayfs/linux-4.18.14/Makefile" ;; "executer/include/qlmpilib.h") CONFIG_FILES="$CONFIG_FILES executer/include/qlmpilib.h" ;; "kernel/Makefile") CONFIG_FILES="$CONFIG_FILES kernel/Makefile" ;; "kernel/Makefile.build") CONFIG_FILES="$CONFIG_FILES kernel/Makefile.build" ;; diff --git a/configure.ac b/configure.ac index 2cc1eeb1..3a2ba579 100644 --- a/configure.ac +++ b/configure.ac @@ -561,6 +561,7 @@ AC_CONFIG_FILES([ executer/kernel/mcoverlayfs/linux-3.10.0-327.36.1.el7/Makefile executer/kernel/mcoverlayfs/linux-4.0.9/Makefile executer/kernel/mcoverlayfs/linux-4.6.7/Makefile + executer/kernel/mcoverlayfs/linux-4.18.14/Makefile executer/include/qlmpilib.h kernel/Makefile kernel/Makefile.build diff --git a/executer/kernel/mcoverlayfs/Makefile.in b/executer/kernel/mcoverlayfs/Makefile.in index c34094de..87bc4e86 100644 --- a/executer/kernel/mcoverlayfs/Makefile.in +++ b/executer/kernel/mcoverlayfs/Makefile.in @@ -18,6 +18,9 @@ endif ifeq ($(BUILD_MODULE),none) BUILD_MODULE=$(shell if [ ${LINUX_VERSION_CODE} -ge 263680 -a ${LINUX_VERSION_CODE} -lt 263936 ]; then echo "linux-4.6.7"; else echo "none"; fi) endif +ifeq ($(BUILD_MODULE),none) +BUILD_MODULE=$(shell if [ ${LINUX_VERSION_CODE} -ge 266752 ]; then echo "linux-4.18.14"; else echo "none"; fi) +endif endif ifeq ($(BUILD_MODULE_TMP),rhel) ifeq ($(BUILD_MODULE),none) @@ -33,13 +36,14 @@ endif modules: ifneq ($(BUILD_MODULE),none) - +@(cd $(BUILD_MODULE); make modules) + +@(cd $(BUILD_MODULE) && make modules) endif clean: - @(cd linux-3.10.0-327.36.1.el7; make clean) - @(cd linux-4.0.9; make clean) - @(cd linux-4.6.7; make clean) + @(cd linux-3.10.0-327.36.1.el7 && make clean) + @(cd linux-4.0.9 && make clean) + @(cd linux-4.6.7 && make clean) + @(cd linux-4.18.14 && make clean) install: ifneq ($(BUILD_MODULE),none) diff --git a/executer/kernel/mcoverlayfs/linux-4.18.14/copy_up.c b/executer/kernel/mcoverlayfs/linux-4.18.14/copy_up.c index ddaddb4c..0f8eff9d 100644 --- a/executer/kernel/mcoverlayfs/linux-4.18.14/copy_up.c +++ b/executer/kernel/mcoverlayfs/linux-4.18.14/copy_up.c @@ -100,6 +100,9 @@ retry: size = vfs_getxattr(old, name, NULL, 0); if (size < 0) { + /* NOFSCHECK */ + continue; + error = size; break; } diff --git a/executer/kernel/mcoverlayfs/linux-4.18.14/inode.c b/executer/kernel/mcoverlayfs/linux-4.18.14/inode.c index ed16a898..c2579a17 100644 --- a/executer/kernel/mcoverlayfs/linux-4.18.14/inode.c +++ b/executer/kernel/mcoverlayfs/linux-4.18.14/inode.c @@ -22,6 +22,9 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr) struct dentry *upperdentry; const struct cred *old_cred; + /* NOCOPYUPW */ + return 0; + /* * Check for permissions before trying to copy-up. This is redundant * since it will be rechecked later by ->setattr() on upper dentry. But @@ -277,6 +280,9 @@ int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name, struct dentry *realdentry = upperdentry ?: ovl_dentry_lower(dentry); const struct cred *old_cred; + /* NOCOPYUPW */ + return 0; + err = ovl_want_write(dentry); if (err) goto out; @@ -405,6 +411,9 @@ int ovl_open_maybe_copy_up(struct dentry *dentry, unsigned int file_flags) { int err = 0; + /* NOCOPYUPW */ + return err; + if (ovl_open_need_copy_up(dentry, file_flags)) { err = ovl_want_write(dentry); if (!err) { diff --git a/executer/kernel/mcoverlayfs/linux-4.18.14/super.c b/executer/kernel/mcoverlayfs/linux-4.18.14/super.c index fa2121f8..0aef1670 100644 --- a/executer/kernel/mcoverlayfs/linux-4.18.14/super.c +++ b/executer/kernel/mcoverlayfs/linux-4.18.14/super.c @@ -24,6 +24,7 @@ MODULE_AUTHOR("Miklos Szeredi "); MODULE_DESCRIPTION("Overlay filesystem"); MODULE_LICENSE("GPL"); +#define MCOVERLAYFS_SUPER_MAGIC 0x4d634f56 struct ovl_dir_cache; @@ -315,7 +316,7 @@ static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf) err = vfs_statfs(&path, buf); if (!err) { buf->f_namelen = ofs->namelen; - buf->f_type = OVERLAYFS_SUPER_MAGIC; + buf->f_type = MCOVERLAYFS_SUPER_MAGIC; } return err; @@ -413,6 +414,8 @@ enum { OPT_XINO_ON, OPT_XINO_OFF, OPT_XINO_AUTO, + OPT_NOCOPYUPW, + OPT_NOFSCHECK, OPT_ERR, }; @@ -429,6 +432,8 @@ static const match_table_t ovl_tokens = { {OPT_XINO_ON, "xino=on"}, {OPT_XINO_OFF, "xino=off"}, {OPT_XINO_AUTO, "xino=auto"}, + {OPT_NOCOPYUPW, "nocopyupw"}, + {OPT_NOFSCHECK, "nofscheck"}, {OPT_ERR, NULL} }; @@ -555,6 +560,11 @@ static int ovl_parse_opt(char *opt, struct ovl_config *config) config->xino = OVL_XINO_AUTO; break; + case OPT_NOCOPYUPW: + case OPT_NOFSCHECK: + /* compat */ + break; + default: pr_err("overlayfs: unrecognized mount option \"%s\" or missing value\n", p); return -EINVAL; @@ -1319,7 +1329,7 @@ static struct ovl_entry *ovl_get_lowerstack(struct super_block *sb, err = -EINVAL; sb->s_stack_depth++; - if (sb->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) { + if (sb->s_stack_depth > /* NOFSCHECK */ 3) { pr_err("overlayfs: maximum fs stacking depth exceeded\n"); goto out_err; } @@ -1453,7 +1463,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) /* Never override disk quota limits or use reserved space */ cap_lower(cred->cap_effective, CAP_SYS_RESOURCE); - sb->s_magic = OVERLAYFS_SUPER_MAGIC; + sb->s_magic = MCOVERLAYFS_SUPER_MAGIC; sb->s_op = &ovl_super_operations; sb->s_xattr = ovl_xattr_handlers; sb->s_fs_info = ofs; @@ -1501,11 +1511,11 @@ static struct dentry *ovl_mount(struct file_system_type *fs_type, int flags, static struct file_system_type ovl_fs_type = { .owner = THIS_MODULE, - .name = "overlay", + .name = "mcoverlay", .mount = ovl_mount, .kill_sb = kill_anon_super, }; -MODULE_ALIAS_FS("overlay"); +MODULE_ALIAS_FS("mcoverlay"); static void ovl_inode_init_once(void *foo) { diff --git a/executer/kernel/mcoverlayfs/linux-4.18.14/util.c b/executer/kernel/mcoverlayfs/linux-4.18.14/util.c index 319a7eeb..018656f9 100644 --- a/executer/kernel/mcoverlayfs/linux-4.18.14/util.c +++ b/executer/kernel/mcoverlayfs/linux-4.18.14/util.c @@ -115,6 +115,8 @@ bool ovl_dentry_remote(struct dentry *dentry) bool ovl_dentry_weird(struct dentry *dentry) { + /* NOFSCHECK */ + return false; return dentry->d_flags & (DCACHE_NEED_AUTOMOUNT | DCACHE_MANAGE_TRANSIT | DCACHE_OP_HASH |