[Devel] [PATCH RHEL8 COMMIT] ve/fs/inotify: do not impose limit on the number of instances by default

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jul 20 16:14:37 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.59
------>
commit b1e5cad10673b645f2fff81b8b82a1cc04953f1b
Author: Vladimir Davydov <vdavydov.dev at gmail.com>
Date:   Tue Jul 20 16:14:37 2021 +0300

    ve/fs/inotify: do not impose limit on the number of instances by default
    
    In Vz7 we haven't switched to user ns yet. As a result, all containers
    use the same user_struct for the same user id. This leads to hitting
    fs.inotify.max_user_instances sysctl limit quickly (it equals 128 by
    default) and failing to start a container. This patch sets the default
    limit to INT_MAX. This is a temporary solution and should be reverted
    once we start using user ns.
    
    In PCS6 there is no such problem, because we actually create a user ns
    per container there. Although its functionality is basic in comparison
    to Vz7, it still results in creating a new user_struct for each user
    inside a container so that the inotify limit is containerized.
    
    https://jira.sw.ru/browse/PSBM-39048
    
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
    
    khorenko@: to be reverted once we support userns in Virtuozzo 7
    (cherry picked from 78c91a02de6b6f0423e12e12128f9433934d7c61)
    Signed-off-by: Valeriy Vdovin<valeriy.vdovin at virtuozoo.com>
    
    https://jira.sw.ru/browse/PSBM-131634
    Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
    
    khorenko@:
    TODO: we have to review all places along this path of using inotifies
    and make sure all allocations are accounted to Containers.
---
 fs/notify/inotify/inotify_user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 591c3367605f..d7a3367370fc 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -824,8 +824,8 @@ static int __init inotify_user_setup(void)
 					       SLAB_PANIC|SLAB_ACCOUNT);
 
 	inotify_max_queued_events = 16384;
-	init_user_ns.ucount_max[UCOUNT_INOTIFY_INSTANCES] = 128;
-	init_user_ns.ucount_max[UCOUNT_INOTIFY_WATCHES] = 8192;
+	init_user_ns.ucount_max[UCOUNT_INOTIFY_INSTANCES] = INT_MAX;
+	init_user_ns.ucount_max[UCOUNT_INOTIFY_WATCHES] = INT_MAX;
 
 	return 0;
 }


More information about the Devel mailing list