[Devel] [PATCH RHEL7 COMMIT] ve/fs: allow mount fs in init userns if it's mounted in another userns

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jul 2 15:10:32 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.3.2.vz7.61.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.3.2.vz7.61.8
------>
commit f8a3e221f5d2bf09a195ab9488b952261dc35c4a
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>
---
 fs/super.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/super.c b/fs/super.c
index 221e681c909c..ca9bd0d261ba 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -494,7 +494,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);
 				if (s) {
 					up_write(&s->s_umount);


More information about the Devel mailing list