[Devel] [PATCH RHEL8 COMMIT] ve/fs: Allow mount fs in init userns if it's mounted in another userns
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Apr 19 19:56:34 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.16
------>
commit 7e64743ced32133e82e7e6311365a1d3db6108bf
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date: Mon Jul 2 14:46:09 2018 +0300
ve/fs: Allow mount fs in init userns if it's mounted in another userns
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>
---
fs/super.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/super.c b/fs/super.c
index 651593446a58..9fda135ee564 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -534,7 +534,12 @@ struct super_block *sget_userns(struct file_system_type *type,
hlist_for_each_entry(old, &type->fs_supers, s_instances) {
if (!test(old, data))
continue;
- 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);
More information about the Devel
mailing list