Sync from internal changes
Signed-off-by: zhangsong234 <zhangsong34@huawei.com>
This commit is contained in:
parent
f7a66de4cb
commit
d7e9d0e9a7
82
0024-fix-proc-diskstats-show-in-container.patch
Normal file
82
0024-fix-proc-diskstats-show-in-container.patch
Normal file
@ -0,0 +1,82 @@
|
||||
From 449ad8444924c5f9d0b6ab646202e9b1655ec7c9 Mon Sep 17 00:00:00 2001
|
||||
From: zhangsong <zhangsong34@huawei.com>
|
||||
Date: Tue, 19 May 2020 21:58:33 +0800
|
||||
Subject: [PATCH] lxcfs: fix proc diskstats show in container
|
||||
|
||||
reason:fix proc diskstats show in container
|
||||
|
||||
Signed-off-by: zhangsong <zhangsong34@huawei.com>
|
||||
---
|
||||
bindings.c | 35 +++++++++++++++++++++--------------
|
||||
1 file changed, 21 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/bindings.c b/bindings.c
|
||||
index 446a1d0..19cd57e 100644
|
||||
--- a/bindings.c
|
||||
+++ b/bindings.c
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <wait.h>
|
||||
+#include <linux/kdev_t.h>
|
||||
#include <linux/magic.h>
|
||||
#include <linux/sched.h>
|
||||
#include <sys/epoll.h>
|
||||
@@ -4145,8 +4146,8 @@ child_out:
|
||||
}
|
||||
end->next = NULL;
|
||||
end->name = must_copy_string(dev_name);
|
||||
- end->major = ((unsigned int)dev_num & 0xff00) >> 8;
|
||||
- end->minor = (unsigned int)dev_num & 0x00ff;
|
||||
+ end->major = MAJOR(dev_num);
|
||||
+ end->minor = MINOR(dev_num);
|
||||
}
|
||||
err:
|
||||
if (stream[0])
|
||||
@@ -4172,7 +4173,8 @@ void free_devinfo_list(struct devinfo *ptr)
|
||||
static bool need_record_diskstats(unsigned int major, unsigned int minor)
|
||||
{
|
||||
//only support device which major is 253.
|
||||
- if (major == 253) {
|
||||
+ // fix: major number 252 is also supported.
|
||||
+ if (major == 253 || major == 252) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -4290,17 +4292,22 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||
tot_ticks = tot_ticks/1000000;
|
||||
|
||||
memset(lbuf, 0, 256);
|
||||
- if (read || write || read_merged || write_merged || read_sectors || write_sectors || read_ticks || write_ticks)
|
||||
- snprintf(lbuf, 256, "%u %u %s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||
- major, minor, dev_name, read, read_merged, read_sectors, read_ticks,
|
||||
- write, write_merged, write_sectors, write_ticks, ios_pgr, tot_ticks, rq_ticks);
|
||||
- else if (need_record_diskstats(major, minor)) {
|
||||
- sscanf(line, "%u %u %71s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||
- &major, &minor, tmp_dev_name, &read, &read_merged, &read_sectors, &read_ticks,
|
||||
- &write, &write_merged, &write_sectors, &write_ticks, &ios_pgr, &tot_ticks, &rq_ticks);
|
||||
- snprintf(lbuf, 256, "%u %u %s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||
- major, minor, dev_name, read, read_merged, read_sectors, read_ticks,
|
||||
- write, write_merged, write_sectors, write_ticks, ios_pgr, tot_ticks, rq_ticks);
|
||||
+ if (read || write || read_merged || write_merged || read_sectors || write_sectors || read_ticks || write_ticks) {
|
||||
+ if (need_record_diskstats(major, minor)) {
|
||||
+ sscanf(line, "%u %u %71s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||
+ &major, &minor, tmp_dev_name, &read, &read_merged, &read_sectors, &read_ticks,
|
||||
+ &write, &write_merged, &write_sectors, &write_ticks, &ios_pgr, &tot_ticks, &rq_ticks);
|
||||
+ }
|
||||
+ snprintf(lbuf, 256, "%u %u %s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||
+ major, minor, dev_name, read, read_merged, read_sectors, read_ticks,
|
||||
+ write, write_merged, write_sectors, write_ticks, ios_pgr, tot_ticks, rq_ticks);
|
||||
+ } else if (need_record_diskstats(major, minor)) {
|
||||
+ sscanf(line, "%u %u %71s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||
+ &major, &minor, tmp_dev_name, &read, &read_merged, &read_sectors, &read_ticks,
|
||||
+ &write, &write_merged, &write_sectors, &write_ticks, &ios_pgr, &tot_ticks, &rq_ticks);
|
||||
+ snprintf(lbuf, 256, "%u %u %s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||
+ major, minor, dev_name, read, read_merged, read_sectors, read_ticks,
|
||||
+ write, write_merged, write_sectors, write_ticks, ios_pgr, tot_ticks, rq_ticks);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
--
|
||||
2.21.0
|
||||
|
||||
80
0025-lxcfs-adapt-4.18-kernel.patch
Normal file
80
0025-lxcfs-adapt-4.18-kernel.patch
Normal file
@ -0,0 +1,80 @@
|
||||
From 5882a762e984ec0091658f458758c44fc63bb9cf Mon Sep 17 00:00:00 2001
|
||||
From: zhangsong <zhangsong34@huawei.com>
|
||||
Date: Tue, 23 Jun 2020 07:43:33 +0800
|
||||
Subject: [PATCH] lxcfs: adapt 4.18 kernel
|
||||
|
||||
Signed-off-by: zhangsong <zhangsong34@huawei.com>
|
||||
---
|
||||
bindings.c | 39 ++++++++++++++++++++-------------------
|
||||
1 file changed, 20 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/bindings.c b/bindings.c
|
||||
index b2043ec..e3fbf29 100644
|
||||
--- a/bindings.c
|
||||
+++ b/bindings.c
|
||||
@@ -4226,15 +4226,12 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||
if (!(io_serviced_str = cgfs_get_value("blkio", cg, "blkio.throttle.io_serviced_recursive"))
|
||||
&& !(io_serviced_str = cgfs_get_value("blkio", cg, "blkio.throttle.io_serviced")))
|
||||
goto err;
|
||||
- if (!(io_merged_str = cgfs_get_value("blkio", cg, "blkio.io_merged_recursive")))
|
||||
- goto err;
|
||||
if (!(io_service_bytes_str = cgfs_get_value("blkio", cg, "blkio.throttle.io_service_bytes_recursive"))
|
||||
&& !(io_service_bytes_str = cgfs_get_value("blkio", cg, "blkio.throttle.io_service_bytes")))
|
||||
goto err;
|
||||
- if (!(io_wait_time_str = cgfs_get_value("blkio", cg, "blkio.io_wait_time_recursive")))
|
||||
- goto err;
|
||||
- if (!(io_service_time_str = cgfs_get_value("blkio", cg, "blkio.io_service_time_recursive")))
|
||||
- goto err;
|
||||
+ io_merged_str = cgfs_get_value("blkio", cg, "blkio.io_merged_recursive");
|
||||
+ io_wait_time_str = cgfs_get_value("blkio", cg, "blkio.io_wait_time_recursive");
|
||||
+ io_service_time_str = cgfs_get_value("blkio", cg, "blkio.io_service_time_recursive");
|
||||
|
||||
|
||||
f = fopen("/proc/diskstats", "r");
|
||||
@@ -4268,26 +4265,30 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||
|
||||
get_blkio_io_value(io_serviced_str, major, minor, "Read", &read);
|
||||
get_blkio_io_value(io_serviced_str, major, minor, "Write", &write);
|
||||
- get_blkio_io_value(io_merged_str, major, minor, "Read", &read_merged);
|
||||
- get_blkio_io_value(io_merged_str, major, minor, "Write", &write_merged);
|
||||
+ if (io_merged_str != NULL) {
|
||||
+ get_blkio_io_value(io_merged_str, major, minor, "Read", &read_merged);
|
||||
+ get_blkio_io_value(io_merged_str, major, minor, "Write", &write_merged);
|
||||
+ }
|
||||
get_blkio_io_value(io_service_bytes_str, major, minor, "Read", &read_sectors);
|
||||
read_sectors = read_sectors/512;
|
||||
get_blkio_io_value(io_service_bytes_str, major, minor, "Write", &write_sectors);
|
||||
write_sectors = write_sectors/512;
|
||||
|
||||
- get_blkio_io_value(io_service_time_str, major, minor, "Read", &rd_svctm);
|
||||
- rd_svctm = rd_svctm/1000000;
|
||||
- get_blkio_io_value(io_wait_time_str, major, minor, "Read", &rd_wait);
|
||||
- rd_wait = rd_wait/1000000;
|
||||
+ if (io_service_time_str != NULL) {
|
||||
+ get_blkio_io_value(io_service_time_str, major, minor, "Read", &rd_svctm);
|
||||
+ rd_svctm = rd_svctm/1000000;
|
||||
+ get_blkio_io_value(io_service_time_str, major, minor, "Write", &wr_svctm);
|
||||
+ wr_svctm = wr_svctm/1000000;
|
||||
+ get_blkio_io_value(io_service_time_str, major, minor, "Total", &tot_ticks);
|
||||
+ }
|
||||
+ if (io_wait_time_str != NULL) {
|
||||
+ get_blkio_io_value(io_wait_time_str, major, minor, "Read", &rd_wait);
|
||||
+ rd_wait = rd_wait/1000000;
|
||||
+ get_blkio_io_value(io_wait_time_str, major, minor, "Write", &wr_wait);
|
||||
+ wr_wait = wr_wait/1000000;
|
||||
+ }
|
||||
read_ticks = rd_svctm + rd_wait;
|
||||
-
|
||||
- get_blkio_io_value(io_service_time_str, major, minor, "Write", &wr_svctm);
|
||||
- wr_svctm = wr_svctm/1000000;
|
||||
- get_blkio_io_value(io_wait_time_str, major, minor, "Write", &wr_wait);
|
||||
- wr_wait = wr_wait/1000000;
|
||||
write_ticks = wr_svctm + wr_wait;
|
||||
-
|
||||
- get_blkio_io_value(io_service_time_str, major, minor, "Total", &tot_ticks);
|
||||
tot_ticks = tot_ticks/1000000;
|
||||
|
||||
memset(lbuf, 0, 256);
|
||||
--
|
||||
2.21.0
|
||||
|
||||
44
0026-lxcfs-fix-get-device-major-and-minor-number.patch
Normal file
44
0026-lxcfs-fix-get-device-major-and-minor-number.patch
Normal file
@ -0,0 +1,44 @@
|
||||
From b0ca5b7ead5891866b0bfec526beffce1095d749 Mon Sep 17 00:00:00 2001
|
||||
From: zhangsong <zhangsong34@huawei.com>
|
||||
Date: Wed, 24 Jun 2020 03:48:39 +0800
|
||||
Subject: [PATCH] lxcfs: fix get device major and minor number
|
||||
|
||||
Signed-off-by: zhangsong <zhangsong34@huawei.com>
|
||||
---
|
||||
bindings.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/bindings.c b/bindings.c
|
||||
index 19cd57e..6e2ded5 100644
|
||||
--- a/bindings.c
|
||||
+++ b/bindings.c
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <wait.h>
|
||||
-#include <linux/kdev_t.h>
|
||||
#include <linux/magic.h>
|
||||
#include <linux/sched.h>
|
||||
#include <sys/epoll.h>
|
||||
@@ -37,6 +36,7 @@
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/sysinfo.h>
|
||||
#include <sys/vfs.h>
|
||||
+#include <sys/sysmacros.h>
|
||||
|
||||
#include "bindings.h"
|
||||
#include "config.h" // for VERSION
|
||||
@@ -4146,8 +4146,8 @@ child_out:
|
||||
}
|
||||
end->next = NULL;
|
||||
end->name = must_copy_string(dev_name);
|
||||
- end->major = MAJOR(dev_num);
|
||||
- end->minor = MINOR(dev_num);
|
||||
+ end->major = major(dev_num);
|
||||
+ end->minor = minor(dev_num);
|
||||
}
|
||||
err:
|
||||
if (stream[0])
|
||||
--
|
||||
2.21.0
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#Basic Information
|
||||
Name: lxcfs
|
||||
Version: 3.0.2
|
||||
Release: 0.10
|
||||
Release: 0.12
|
||||
Summary: FUSE filesystem for LXC
|
||||
License: Apache-2.0
|
||||
URL: http://linuxcontainers.org
|
||||
@ -33,6 +33,9 @@ Patch9020: 0020-lxcfs-proc_diskstats_read-func-obtain-data-from-blki.patch
|
||||
Patch9021: 0021-remove-securec-functions.patch
|
||||
Patch9022: 0022-add-secure-compile-option-in-Makefile.patch
|
||||
Patch9023: 0023-fix-missing-include-in-tests.patch
|
||||
Patch9024: 0024-fix-proc-diskstats-show-in-container.patch
|
||||
Patch9025: 0025-lxcfs-adapt-4.18-kernel.patch
|
||||
Patch9026: 0026-lxcfs-fix-get-device-major-and-minor-number.patch
|
||||
|
||||
#Dependency
|
||||
BuildRequires: autoconf automake libtool help2man
|
||||
@ -92,6 +95,9 @@ fi
|
||||
%{_unitdir}/*
|
||||
|
||||
%changelog
|
||||
* Thu July 02 2020 openEuler Buildteam <buildteam@openeuler.org> - 3.0.2-0.12
|
||||
- Sync from internal changes
|
||||
|
||||
* Thu Dec 26 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.0.2-0.5.h2
|
||||
- Remove securec functions
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user