[Devel] [PATCH RH9 3/3] commit 22b5a8a84548

Kirill Tkhai ktkhai at virtuozzo.com
Mon Oct 11 18:50:00 MSK 2021


From: Vladimir Davydov <vdavydov.dev at gmail.com>

    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 62051247f6d2..d30a459136b6 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -847,8 +847,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] = watches_max;
+	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