[Devel] [PATCH RH8] ve/proc/block: show /proc/diskstats inside a Container
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Jun 2 19:45:45 MSK 2021
On 05/31/2021 10:00 AM, Vasily Averin wrote:
> The proc file is virtualized, so it contains stats for only those block
> devices which are allowed by device cgroup related to the Container.
>
> https://jira.sw.ru/browse/PSBM-90491
> https://jira.sw.ru/browse/PSBM-92107
>
> Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
> (cherry picked from vz7 commit ded5965d1d58deeb84509b9b490e9b6f71d0f73b)
> Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
> ---
> block/genhd.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/block/genhd.c b/block/genhd.c
> index 5d4363e4296a..dd20fa3c7bb6 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -1463,6 +1463,7 @@ static const struct device_type disk_type = {
> */
> static int diskstats_show(struct seq_file *seqf, void *v)
> {
> + struct ve_struct *ve = get_exec_env();
> struct gendisk *gp = v;
> struct disk_part_iter piter;
> struct hd_struct *hd;
> @@ -1479,6 +1480,11 @@ static int diskstats_show(struct seq_file *seqf, void *v)
>
> disk_part_iter_init(&piter, gp, DISK_PITER_INCL_EMPTY_PART0);
> while ((hd = disk_part_iter_next(&piter))) {
> + if (!ve_is_super(ve) &&
> + (devcgroup_device_permission(S_IFBLK, part_devt(hd),
> + MAY_READ)))
> + continue;
> +
> inflight = part_in_flight(gp->queue, hd);
> seq_printf(seqf, "%4d %7d %s "
> "%lu %lu %lu %u "
> @@ -1518,8 +1524,13 @@ static const struct seq_operations diskstats_op = {
>
> static int __init proc_genhd_init(void)
> {
> +<<<<<<< HEAD
> proc_create_seq("diskstats", 0, NULL, &diskstats_op);
> proc_create_seq("partitions", S_ISVTX, NULL, &partitions_op);
> +=======
> + proc_create("diskstats", S_ISVTX, NULL, &proc_diskstats_operations);
> + proc_create("partitions", S_ISVTX, NULL, &proc_partitions_operations);
> +>>>>>>> ded5965d1d58... ve/proc/block: show /proc/diskstats inside a Container
^^^
> return 0;
> }
> module_init(proc_genhd_init);
>
More information about the Devel
mailing list