This variable doesn't exist when !CONFIG_VE. Use get_ve0 where possible or hide code under ifdefs.
https://virtuozzo.atlassian.net/browse/VSTOR-130116 Feature: !CONFIG_VE build Signed-off-by: Vladimir Riabchun <[email protected]> --- fs/aio.c | 7 +++++++ fs/coredump.c | 2 ++ fs/sysctls.c | 2 ++ include/linux/sysctl.h | 3 ++- kernel/cgroup/cgroup-v1.c | 6 +++--- kernel/sysctl.c | 4 ++++ 6 files changed, 20 insertions(+), 4 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index c6c3e5808ceb..6b67adbf057d 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -225,14 +225,21 @@ struct aio_kiocb { static struct ctl_table aio_sysctls[] = { { .procname = "aio-nr", +/* When !CONFIG_VE this doesn't matter - we take + * ve->aio_nr_lock, but ve is NULL + */ +#ifdef CONFIG_VE .data = &ve0.aio_nr, +#endif .maxlen = sizeof(unsigned long), .mode = 0444 | S_ISVTX, .proc_handler = proc_doulongvec_minmax_virtual, }, { .procname = "aio-max-nr", +#ifdef CONFIG_VE .data = &ve0.aio_max_nr, +#endif .maxlen = sizeof(unsigned long), .mode = 0644 | S_ISVTX, .proc_handler = proc_doulongvec_minmax_virtual, diff --git a/fs/coredump.c b/fs/coredump.c index fed2436cc846..720fec759978 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -1013,7 +1013,9 @@ static struct ctl_table coredump_sysctls[] = { }, { .procname = "core_pattern", +#ifdef CONFIG_VE .data = ve0.core_pattern, +#endif .maxlen = CORENAME_MAX_SIZE, .mode = 0644 | S_ISVTX, .proc_handler = proc_dostring_coredump_virtual, diff --git a/fs/sysctls.c b/fs/sysctls.c index dfe2782f58f4..3c68cbdf6914 100644 --- a/fs/sysctls.c +++ b/fs/sysctls.c @@ -28,6 +28,7 @@ static struct ctl_table fs_shared_sysctls[] = { .extra1 = SYSCTL_ZERO, .extra2 = SYSCTL_MAXOLDUID, }, +#ifdef CONFIG_VE { .procname = "odirect_enable", .data = &ve0.odirect_enable, @@ -35,6 +36,7 @@ static struct ctl_table fs_shared_sysctls[] = { .mode = 0644 | S_ISVTX, .proc_handler = proc_dointvec_virtual, }, +#endif }; static int __init init_fs_sysctls(void) diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 2fab3ecfaf88..76b32ba9f7bd 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -94,7 +94,8 @@ int sysctl ## _virtual(const struct ctl_table *table, int write, \ void *buffer, size_t *lenp, loff_t *ppos) \ { \ struct ctl_table tmp = *table; \ - if (virtual_ptr(&tmp.data, &ve0, sizeof(ve0), get_exec_env())) \ + if (virtual_ptr(&tmp.data, get_ve0(), \ + sizeof(struct ve_struct), get_exec_env())) \ return sysctl(&tmp, write, buffer, lenp, ppos); \ return -EINVAL; \ } diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index e4ef76e4bde6..dfa9b0c83082 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -581,7 +581,7 @@ static ssize_t cgroup_release_agent_write(struct kernfs_open_file *of, root_cgrp = cgroup_ve_root1(cgrp); if (!root_cgrp) { if (ve_is_super(get_exec_env()) && cgrp == &cgrp->root->cgrp) - ve = &ve0; + ve = get_ve0(); } else { if (root_cgrp == cgrp) ve = rcu_dereference(root_cgrp->ve_owner); @@ -612,7 +612,7 @@ static int cgroup_release_agent_show(struct seq_file *seq, void *v) root_cgrp = cgroup_ve_root1(cgrp); if (!root_cgrp) { if (ve_is_super(get_exec_env()) && cgrp == &cgrp->root->cgrp) - ve = &ve0; + ve = get_ve0(); } else { if (root_cgrp == cgrp) ve = rcu_dereference(root_cgrp->ve_owner); @@ -930,7 +930,7 @@ void cgroup1_release_agent(struct work_struct *work) ret = call_usermodehelper_ve(ve, argv[0], argv, envp, UMH_WAIT_EXEC); - if (ret < 0 && ve == &ve0) + if (ret < 0 && ve == get_ve0()) pr_warn_ratelimited("cgroup1_release_agent " "%s %s failed: %d\n", agentbuf, pathbuf, ret); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index ac4cb49e4b7e..bbe64929a56c 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1973,7 +1973,11 @@ static struct ctl_table kern_table[] = { #if defined(CONFIG_MMU) { .procname = "randomize_va_space", +#ifdef CONFIG_VE .data = &ve0._randomize_va_space, +#else + .data = &_randomize_va_space, +#endif .maxlen = sizeof(int), .mode = 0644 | S_ISVTX, .proc_handler = proc_dointvec_virtual, -- 2.43.0 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
