[Devel] [PATCH RH9 12/22] ve/fs: Allow mount fs in init userns if it's mounted in another userns

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Thu Oct 7 13:57:36 MSK 2021


From: Konstantin Khorenko <khorenko at virtuozzo.com>

We mount secondary ploop on host for resize functionality so allow mount
in init userns if fs already mounted in non-init userns.

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

Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>

This hack is also needed for "vzctl snapshot-mount ..."
functionality for running Containers.

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

(cherry picked from vz7 commit f8a3e221f5d2 ("ve/fs: allow mount fs in
init userns if it's mounted in another userns"))

Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>

(cherry picked from vz8 commit a6d67427a9c921b685dc20cd64025770b950203c)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 fs/super.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/super.c b/fs/super.c
index 5ea020b..d3f48cf 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -582,7 +582,12 @@ struct super_block *sget_fc(struct fs_context *fc,
 	return s;
 
 share_extant_sb:
-	if (user_ns != old->s_user_ns) {
+	/* PSBM-86208: we mount secondary ploop on host for
+	 * resize functionality so allow mount in init userns
+	 * if fs already mounted in non-init userns
+	 */
+	if (user_ns != old->s_user_ns &&
+	    user_ns != &init_user_ns) {
 		spin_unlock(&sb_lock);
 		destroy_unused_super(s);
 		return ERR_PTR(-EBUSY);
-- 
1.8.3.1



More information about the Devel mailing list