sysctl "fs.ve-mount-nr" is unsigned int and is casted to "int" while
comparing values => if we set it to a value > INT_MAX, VE won't be able to
mount anything after that.
=> set a max value for sysctl == INT_MAX

https://jira.sw.ru/browse/PSBM-69880

Signed-off-by: Konstantin Khorenko <khore...@virtuozzo.com>
---
 kernel/ve/veowner.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/ve/veowner.c b/kernel/ve/veowner.c
index 8df6390..a7fe9cc 100644
--- a/kernel/ve/veowner.c
+++ b/kernel/ve/veowner.c
@@ -83,6 +83,8 @@ static void prepare_proc(void)
  * points for a VE.
  */
 unsigned int sysctl_ve_mount_nr = 4096;
+static int ve_mount_nr_min = 0;
+static int ve_mount_nr_max = INT_MAX;
 
 static struct ctl_table vz_fs_table[] = {
        {
@@ -97,7 +99,9 @@ static struct ctl_table vz_fs_table[] = {
                .data           = &sysctl_ve_mount_nr,
                .maxlen         = sizeof(sysctl_ve_mount_nr),
                .mode           = 0644,
-               .proc_handler   = proc_dointvec,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = &ve_mount_nr_min,
+               .extra2         = &ve_mount_nr_max,
        },
        { 0 }
 };
-- 
1.8.3.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to