[Devel] [PATCH RHEL7 COMMIT] ve: Strip unset options in ve.mount_opts

Konstantin Khorenko khorenko at virtuozzo.com
Thu Oct 15 03:37:17 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.8.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.8.6
------>
commit 5e85a8088c27b22a38d446530fab6904db6314a4
Author: Kirill Tkhai <ktkhai at odin.com>
Date:   Thu Oct 15 14:37:13 2015 +0400

    ve: Strip unset options in ve.mount_opts
    
    Igor reports "(null)" in not set options may confuse user:
    
    echo "0 182:223361;1 balloon_ino=12,pfcache_csum,,2: (null);"
    
    The patch removes not set options from there:
    
    echo "0 182:223361;1 balloon_ino=12,pfcache_csum,,;"
    
    N.B. No any problem there, because *printf handles
    zero strings for a long time.
    
    Requested-by: Igor Sukhih <igor at odin.com>
    Signed-off-by: Kirill Tkhai <ktkhai at odin.com>
    Reviewed-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 kernel/ve/ve.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 12cfa33..39a95e8 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -906,9 +906,12 @@ static int ve_mount_opts_show(struct seq_file *m, void *v)
 	struct ve_devmnt *devmnt = v;
 	dev_t dev = devmnt->dev;
 
-	seq_printf(m, "0 %u:%u;1 %s;2 %s;\n", MAJOR(dev), MINOR(dev),
-					      devmnt->hidden_options,
-					      devmnt->allowed_options);
+	seq_printf(m, "0 %u:%u;", MAJOR(dev), MINOR(dev));
+	if (devmnt->hidden_options)
+		seq_printf(m, "1 %s;", devmnt->hidden_options);
+	if (devmnt->allowed_options)
+		seq_printf(m, "2 %s;", devmnt->allowed_options);
+	seq_putc(m, '\n');
 	return 0;
 }
 



More information about the Devel mailing list