[Devel] [PATCH RHEL7 COMMIT] ve/block: Show CT allowed partitions in /proc/partitions

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jul 16 08:57:34 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.25
------>
commit d74d810fb13917a0da4c23a7f4adafe557995de0
Author: Kirill Tkhai <ktkhai at odin.com>
Date:   Thu Jul 16 19:57:34 2015 +0400

    ve/block: Show CT allowed partitions in /proc/partitions
    
    blkid needs /proc/partitions to populate /etc/blkid/blkid.tab.
    If it's not populated, mount by UUID does not work.
    
    https://jira.sw.ru/browse/PSBM-34805
    
    Signed-off-by: Kirill Tkhai <ktkhai at odin.com>
---
 block/genhd.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 938b988..fd18e38 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -853,9 +853,6 @@ static int show_partition(struct seq_file *seqf, void *v)
 	struct hd_struct *part;
 	char buf[BDEVNAME_SIZE];
 
-	if (!ve_is_super(get_exec_env()))
-		return 0;
-
 	/* Don't show non-partitionable removeable devices or empty devices */
 	if (!get_capacity(sgp) || (!disk_max_parts(sgp) &&
 				   (sgp->flags & GENHD_FL_REMOVABLE)))
@@ -865,11 +862,15 @@ static int show_partition(struct seq_file *seqf, void *v)
 
 	/* show the full disk and all non-0 size partitions of it */
 	disk_part_iter_init(&piter, sgp, DISK_PITER_INCL_PART0);
-	while ((part = disk_part_iter_next(&piter)))
-		seq_printf(seqf, "%4d  %7d %10llu %s\n",
-			   MAJOR(part_devt(part)), MINOR(part_devt(part)),
+	while ((part = disk_part_iter_next(&piter))) {
+		unsigned int major = MAJOR(part_devt(part));
+		unsigned int minor = MINOR(part_devt(part));
+
+		if (devcgroup_device_visible(S_IFBLK, major, minor, 1))
+			seq_printf(seqf, "%4d  %7d %10llu %s\n", major, minor,
 			   (unsigned long long)part_nr_sects_read(part) >> 1,
 			   disk_name(sgp, part->partno, buf));
+	}
 	disk_part_iter_exit(&piter);
 
 	return 0;



More information about the Devel mailing list