[Devel] [PATCH rh7] block: Show CT allowed partitions in /proc/partitions

Kirill Tkhai ktkhai at odin.com
Mon Jul 13 08:54:53 PDT 2015


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