Compare commits
No commits in common. "8ef97f8c61bb4aba3da520e10ff0ce42a58b7679" and "f52286e1548a16ca9e41b3dc183c90981250b822" have entirely different histories.
8ef97f8c61
...
f52286e154
@ -1,31 +1,28 @@
|
|||||||
From c0a2baa7e79ef6d7a0060611b4244c4946c246b8 Mon Sep 17 00:00:00 2001
|
From fdc8835afc38ba10f2d1ef97d19a631e58552a27 Mon Sep 17 00:00:00 2001
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
Date: Tue, 11 Jul 2023 08:41:53 +0000
|
Date: Thu, 25 Nov 2021 11:03:32 +0800
|
||||||
Subject: [PATCH 01/15] systemd
|
Subject: [PATCH 01/17] systemd
|
||||||
|
|
||||||
append:remove-lxcfs-tools-dependency-for-common-use
|
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
---
|
||||||
config/init/systemd/lxcfs.service.in | 10 +++++++---
|
config/init/systemd/lxcfs.service.in | 10 +++++++---
|
||||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
diff --git a/config/init/systemd/lxcfs.service.in b/config/init/systemd/lxcfs.service.in
|
diff --git a/config/init/systemd/lxcfs.service.in b/config/init/systemd/lxcfs.service.in
|
||||||
index 8b43f5a..bae1d08 100644
|
index 9cd4e59..3d763c6 100644
|
||||||
--- a/config/init/systemd/lxcfs.service.in
|
--- a/config/init/systemd/lxcfs.service.in
|
||||||
+++ b/config/init/systemd/lxcfs.service.in
|
+++ b/config/init/systemd/lxcfs.service.in
|
||||||
@@ -6,12 +6,16 @@ Documentation=man:lxcfs(1)
|
@@ -5,12 +5,16 @@ Before=lxc.service
|
||||||
|
Documentation=man:lxcfs(1)
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
OOMScoreAdjust=-1000
|
-ExecStart=/usr/bin/lxcfs @LXCFSTARGETDIR@
|
||||||
-ExecStart=/usr/bin/lxcfs {{LXCFSTARGETDIR}}
|
+ExecStartPre=/usr/local/bin/lxcfs-tools prestart
|
||||||
+ExecStartPre=-/usr/local/bin/lxcfs-tools prestart
|
|
||||||
+ExecStart=/usr/bin/lxcfs /var/lib/lxc/lxcfs/
|
+ExecStart=/usr/bin/lxcfs /var/lib/lxc/lxcfs/
|
||||||
+ExecStartPost=-/usr/local/bin/lxcfs-tools remount -a
|
+ExecStartPost=/usr/local/bin/lxcfs-tools remount -a
|
||||||
KillMode=process
|
KillMode=process
|
||||||
-Restart=on-failure
|
-Restart=on-failure
|
||||||
-ExecStopPost=-/bin/fusermount -u {{LXCFSTARGETDIR}}
|
-ExecStopPost=-/bin/fusermount -u @LXCFSTARGETDIR@
|
||||||
+ExecStop=-/usr/local/bin/lxcfs-tools umount -a
|
+ExecStop=/usr/local/bin/lxcfs-tools umount -a
|
||||||
+ExecStopPost=-/bin/fusermount -u /var/lib/lxc/
|
+ExecStopPost=-/bin/fusermount -u /var/lib/lxc/
|
||||||
Delegate=yes
|
Delegate=yes
|
||||||
ExecReload=/bin/kill -USR1 $MAINPID
|
ExecReload=/bin/kill -USR1 $MAINPID
|
||||||
@ -35,5 +32,5 @@ index 8b43f5a..bae1d08 100644
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
--
|
--
|
||||||
2.41.0
|
2.27.0
|
||||||
|
|
||||||
|
|||||||
33
0002-remove-sysvinit-upstart.patch
Normal file
33
0002-remove-sysvinit-upstart.patch
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
From 246b0b52ad671fc37a2bc289701260e5128ecd1f Mon Sep 17 00:00:00 2001
|
||||||
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
|
Date: Thu, 25 Nov 2021 11:11:05 +0800
|
||||||
|
Subject: [PATCH 02/17] remove-sysvinit-upstart
|
||||||
|
|
||||||
|
---
|
||||||
|
config/init/Makefile.am | 2 +-
|
||||||
|
configure.ac | 2 --
|
||||||
|
2 files changed, 1 insertion(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config/init/Makefile.am b/config/init/Makefile.am
|
||||||
|
index e2ffe28..3439c97 100644
|
||||||
|
--- a/config/init/Makefile.am
|
||||||
|
+++ b/config/init/Makefile.am
|
||||||
|
@@ -1 +1 @@
|
||||||
|
-SUBDIRS = systemd sysvinit upstart
|
||||||
|
+SUBDIRS = systemd
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index ccea4ec..d15ac50 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -45,8 +45,6 @@ AC_CONFIG_FILES([
|
||||||
|
config/init/Makefile
|
||||||
|
config/init/systemd/Makefile
|
||||||
|
config/init/systemd/lxcfs.service
|
||||||
|
- config/init/sysvinit/Makefile
|
||||||
|
- config/init/upstart/Makefile
|
||||||
|
|
||||||
|
doc/Makefile
|
||||||
|
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -1,25 +1,17 @@
|
|||||||
From 79d335011ffccfee542ee5068fda6257a9ac1e59 Mon Sep 17 00:00:00 2001
|
From d6234626d7240952da42902b7ef513d56d5a18a7 Mon Sep 17 00:00:00 2001
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
Date: Thu, 27 Jul 2023 06:40:47 +0000
|
Date: Thu, 25 Nov 2021 11:32:37 +0800
|
||||||
Subject: [PATCH 02/15] show dev name in container
|
Subject: [PATCH 03/17] show-dev-name-in-container
|
||||||
|
|
||||||
append: fix hang
|
|
||||||
append: limit-stat-by-quota-period-setting
|
|
||||||
append: fix-proc-diskstats-show-in-container
|
|
||||||
append: proc_fuse fix wait child process hang
|
|
||||||
append: fix deadlock problem when subprocess exit
|
|
||||||
append: fix dev read memory leak in container
|
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
---
|
||||||
src/proc_fuse.c | 183 +++++++++++++++++++++++++++++++++++++++++++++++-
|
src/proc_fuse.c | 145 +++++++++++++++++++++++++++++++++++++++++++++++-
|
||||||
1 file changed, 181 insertions(+), 2 deletions(-)
|
1 file changed, 143 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
||||||
index 25af10a..cde48ca 100644
|
index 94168c9..7372a36 100644
|
||||||
--- a/src/proc_fuse.c
|
--- a/src/proc_fuse.c
|
||||||
+++ b/src/proc_fuse.c
|
+++ b/src/proc_fuse.c
|
||||||
@@ -28,6 +28,7 @@
|
@@ -27,6 +27,7 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
@ -27,40 +19,13 @@ index 25af10a..cde48ca 100644
|
|||||||
#include <sys/vfs.h>
|
#include <sys/vfs.h>
|
||||||
|
|
||||||
#include "proc_fuse.h"
|
#include "proc_fuse.h"
|
||||||
@@ -43,6 +44,26 @@
|
@@ -448,6 +449,132 @@ static void get_blkio_io_value(char *str, unsigned major, unsigned minor,
|
||||||
#include "proc_cpuview.h"
|
|
||||||
#include "utils.h"
|
|
||||||
|
|
||||||
+static pthread_mutex_t container_dev_mutex = PTHREAD_MUTEX_INITIALIZER;
|
|
||||||
+
|
|
||||||
+static void lock_mutex(pthread_mutex_t *l)
|
|
||||||
+{
|
|
||||||
+ int ret;
|
|
||||||
+
|
|
||||||
+ ret = pthread_mutex_lock(l);
|
|
||||||
+ if (ret)
|
|
||||||
+ log_exit("%s - returned %d\n", strerror(ret), ret);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void unlock_mutex(pthread_mutex_t *l)
|
|
||||||
+{
|
|
||||||
+ int ret;
|
|
||||||
+
|
|
||||||
+ ret = pthread_mutex_unlock(l);
|
|
||||||
+ if (ret)
|
|
||||||
+ log_exit("%s - returned %d\n", strerror(ret), ret);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
struct memory_stat {
|
|
||||||
uint64_t hierarchical_memory_limit;
|
|
||||||
uint64_t hierarchical_memsw_limit;
|
|
||||||
@@ -473,6 +494,146 @@ static void get_blkio_io_value(char *str, unsigned major, unsigned minor,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+struct devinfo {
|
+struct devinfo {
|
||||||
+ char *name;
|
+ char *name;
|
||||||
+ unsigned int major, minor;
|
+ int major, minor;
|
||||||
+ struct devinfo *next;
|
+ struct devinfo *next;
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
@ -78,7 +43,7 @@ index 25af10a..cde48ca 100644
|
|||||||
+ struct dirent *ptr;
|
+ struct dirent *ptr;
|
||||||
+ struct stat dev_stat;
|
+ struct stat dev_stat;
|
||||||
+ struct devinfo *head = NULL, *end;
|
+ struct devinfo *head = NULL, *end;
|
||||||
+ char fpath[261], dev_name[101];
|
+ char fpath[100], dev_name[100];
|
||||||
+ pid_t child_pid;
|
+ pid_t child_pid;
|
||||||
+ int mypipe[2];
|
+ int mypipe[2];
|
||||||
+ int dev_num;
|
+ int dev_num;
|
||||||
@ -97,16 +62,6 @@ index 25af10a..cde48ca 100644
|
|||||||
+ return head;
|
+ return head;
|
||||||
+ }
|
+ }
|
||||||
+ if (child_pid == 0) {
|
+ if (child_pid == 0) {
|
||||||
+ /* Disallow signal reception in child process */
|
|
||||||
+ sigset_t oldset;
|
|
||||||
+ sigset_t newset;
|
|
||||||
+ sigemptyset(&newset);
|
|
||||||
+ sigaddset(&newset, SIGTERM);
|
|
||||||
+ sigaddset(&newset, SIGINT);
|
|
||||||
+ sigaddset(&newset, SIGHUP);
|
|
||||||
+ sigaddset(&newset, SIGQUIT);
|
|
||||||
+ sigprocmask(SIG_BLOCK,&newset,&oldset);
|
|
||||||
+
|
|
||||||
+ close(mypipe[0]);
|
+ close(mypipe[0]);
|
||||||
+ stream = fdopen(mypipe[1], "w");
|
+ stream = fdopen(mypipe[1], "w");
|
||||||
+ if (stream == NULL) {
|
+ if (stream == NULL) {
|
||||||
@ -132,30 +87,27 @@ index 25af10a..cde48ca 100644
|
|||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
+ memset(fpath, 0, sizeof(fpath));
|
+ memset(fpath, 0, sizeof(fpath));
|
||||||
+ snprintf(fpath, 261, "/dev/%s", ptr->d_name);
|
+ snprintf(fpath, 99, "/dev/%s", ptr->d_name);
|
||||||
+ stat(fpath, &dev_stat);
|
+ stat(fpath, &dev_stat);
|
||||||
+ fprintf(stream, "%s %ld ", ptr->d_name, dev_stat.st_rdev);
|
+ fprintf(stream, "%s %d ", ptr->d_name, dev_stat.st_rdev);
|
||||||
+ fflush(stream);
|
+ fflush(stream);
|
||||||
+ }
|
+ }
|
||||||
+ closedir(dir);
|
+ closedir(dir);
|
||||||
+ stat("/", &dev_stat);
|
+ stat("/", &dev_stat);
|
||||||
+ dev_num = dev_stat.st_dev;
|
+ dev_num = dev_stat.st_dev & (~0xf);
|
||||||
+ fprintf(stream, "sda %d end 0 ", dev_num);
|
+ fprintf(stream, "sda %d end 0 ", dev_num);
|
||||||
+ fflush(stream);
|
+ fflush(stream);
|
||||||
+child_out:
|
|
||||||
+ fclose(stream);
|
+ fclose(stream);
|
||||||
+ _exit(EXIT_SUCCESS);
|
+ exit(0);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+child_out:
|
||||||
+ close(mypipe[1]);
|
+ close(mypipe[1]);
|
||||||
+ stream = fdopen(mypipe[0], "r");
|
+ stream = fdopen(mypipe[0], "r");
|
||||||
+ if (stream == NULL) {
|
+ if (stream == NULL) {
|
||||||
+ lxcfs_error("Error opening pipe for reading: %s\n", strerror(errno));
|
+ lxcfs_error("Error opening pipe for reading: %s\n", strerror(errno));
|
||||||
+ goto err;
|
+ goto err;
|
||||||
+ }
|
+ }
|
||||||
+ wait_for_pid(child_pid);
|
|
||||||
+ child_pid = 0;
|
|
||||||
+ memset(dev_name, 0, sizeof(dev_name));
|
|
||||||
+ while (fscanf(stream, "%100s%d", dev_name, &dev_num) == 2) {
|
+ while (fscanf(stream, "%100s%d", dev_name, &dev_num) == 2) {
|
||||||
+ if (dev_num == 0) {
|
+ if (dev_num == 0) {
|
||||||
+ break;
|
+ break;
|
||||||
@ -175,7 +127,6 @@ index 25af10a..cde48ca 100644
|
|||||||
+ end->name = must_copy_string(dev_name);
|
+ end->name = must_copy_string(dev_name);
|
||||||
+ end->major = major(dev_num);
|
+ end->major = major(dev_num);
|
||||||
+ end->minor = minor(dev_num);
|
+ end->minor = minor(dev_num);
|
||||||
+ memset(dev_name, 0, sizeof(dev_name));
|
|
||||||
+ }
|
+ }
|
||||||
+err:
|
+err:
|
||||||
+ if (stream)
|
+ if (stream)
|
||||||
@ -201,7 +152,7 @@ index 25af10a..cde48ca 100644
|
|||||||
struct lxcfs_diskstats {
|
struct lxcfs_diskstats {
|
||||||
unsigned int major; /* 1 - major number */
|
unsigned int major; /* 1 - major number */
|
||||||
unsigned int minor; /* 2 - minor mumber */
|
unsigned int minor; /* 2 - minor mumber */
|
||||||
@@ -505,6 +666,7 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
@@ -480,6 +607,7 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
__do_fclose FILE *f = NULL;
|
__do_fclose FILE *f = NULL;
|
||||||
struct fuse_context *fc = fuse_get_context();
|
struct fuse_context *fc = fuse_get_context();
|
||||||
struct file_info *d = INTTYPE_TO_PTR(fi->fh);
|
struct file_info *d = INTTYPE_TO_PTR(fi->fh);
|
||||||
@ -209,13 +160,11 @@ index 25af10a..cde48ca 100644
|
|||||||
struct lxcfs_diskstats stats = {};
|
struct lxcfs_diskstats stats = {};
|
||||||
/* helper fields */
|
/* helper fields */
|
||||||
uint64_t read_service_time, write_service_time, discard_service_time, read_wait_time,
|
uint64_t read_service_time, write_service_time, discard_service_time, read_wait_time,
|
||||||
@@ -574,14 +736,26 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
@@ -549,13 +677,22 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
if (!f)
|
if (!f)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
+ lock_mutex(&container_dev_mutex);
|
|
||||||
+ container_devinfo = container_dev_read(initpid);
|
+ container_devinfo = container_dev_read(initpid);
|
||||||
+ unlock_mutex(&container_dev_mutex);
|
|
||||||
+
|
+
|
||||||
while (getline(&line, &linelen, f) != -1) {
|
while (getline(&line, &linelen, f) != -1) {
|
||||||
ssize_t l;
|
ssize_t l;
|
||||||
@ -225,19 +174,17 @@ index 25af10a..cde48ca 100644
|
|||||||
i = sscanf(line, "%u %u %71s", &stats.major, &stats.minor, stats.dev_name);
|
i = sscanf(line, "%u %u %71s", &stats.major, &stats.minor, stats.dev_name);
|
||||||
if (i != 3)
|
if (i != 3)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
+ for (ptr = container_devinfo; ptr != NULL; ptr = ptr->next) {
|
+ for (ptr = container_devinfo; ptr != NULL; ptr = ptr->next) {
|
||||||
+ if (stats.major == ptr->major && stats.minor == ptr->minor) {
|
+ if (stats.major == ptr->major && stats.minor == ptr->minor) {
|
||||||
+ snprintf(stats.dev_name, sizeof(stats.dev_name), "%s", ptr->name);
|
+ snprintf(stats.dev_name, sizeof(stats.dev_name), "%s", ptr->name);
|
||||||
+ stats.dev_name[71] = '\0';
|
+ stats.dev_name[71] = '\0';
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
get_blkio_io_value(io_serviced_str, stats.major, stats.minor, "Read", &stats.read);
|
get_blkio_io_value(io_serviced_str, stats.major, stats.minor, "Read", &stats.read);
|
||||||
get_blkio_io_value(io_serviced_str, stats.major, stats.minor, "Write", &stats.write);
|
get_blkio_io_value(io_serviced_str, stats.major, stats.minor, "Write", &stats.write);
|
||||||
get_blkio_io_value(io_serviced_str, stats.major, stats.minor, "Discard", &stats.discard);
|
@@ -620,10 +757,14 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
@@ -672,10 +846,14 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
l = snprintf(cache, cache_size, "%s", lbuf);
|
l = snprintf(cache, cache_size, "%s", lbuf);
|
||||||
- if (l < 0)
|
- if (l < 0)
|
||||||
@ -253,14 +200,6 @@ index 25af10a..cde48ca 100644
|
|||||||
|
|
||||||
cache += l;
|
cache += l;
|
||||||
cache_size -= l;
|
cache_size -= l;
|
||||||
@@ -687,6 +865,7 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
|
||||||
if (total_len > size)
|
|
||||||
total_len = size;
|
|
||||||
memcpy(buf, d->buf, total_len);
|
|
||||||
+ free_devinfo_list(container_devinfo);
|
|
||||||
|
|
||||||
return total_len;
|
|
||||||
}
|
|
||||||
--
|
--
|
||||||
2.41.0
|
2.27.0
|
||||||
|
|
||||||
@ -1,18 +1,17 @@
|
|||||||
From 735d69c8696b5ddc8090ad7906f07fe2fe5f9992 Mon Sep 17 00:00:00 2001
|
From 1901edf2908551cf862f3deabf23acbda55d2dea Mon Sep 17 00:00:00 2001
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
Date: Thu, 27 Jul 2023 07:00:28 +0000
|
Date: Thu, 25 Nov 2021 11:52:05 +0800
|
||||||
Subject: [PATCH 03/15] lxcfs fix cpuinfo print
|
Subject: [PATCH 04/17] lxcfs-fix-cpuinfo-print
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
---
|
||||||
src/proc_cpuview.c | 12 +++++++++++-
|
src/proc_cpuview.c | 12 +++++++++++-
|
||||||
1 file changed, 11 insertions(+), 1 deletion(-)
|
1 file changed, 11 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/src/proc_cpuview.c b/src/proc_cpuview.c
|
diff --git a/src/proc_cpuview.c b/src/proc_cpuview.c
|
||||||
index f5464de..76f8089 100644
|
index 9f6a55e..75006a6 100644
|
||||||
--- a/src/proc_cpuview.c
|
--- a/src/proc_cpuview.c
|
||||||
+++ b/src/proc_cpuview.c
|
+++ b/src/proc_cpuview.c
|
||||||
@@ -1051,7 +1051,17 @@ int proc_cpuinfo_read(char *buf, size_t size, off_t offset,
|
@@ -970,7 +970,17 @@ int proc_cpuinfo_read(char *buf, size_t size, off_t offset,
|
||||||
|
|
||||||
}
|
}
|
||||||
if (am_printing) {
|
if (am_printing) {
|
||||||
@ -32,5 +31,5 @@ index f5464de..76f8089 100644
|
|||||||
return log_error(0, "Failed to write cache");
|
return log_error(0, "Failed to write cache");
|
||||||
if ((size_t)l >= cache_size)
|
if ((size_t)l >= cache_size)
|
||||||
--
|
--
|
||||||
2.41.0
|
2.27.0
|
||||||
|
|
||||||
@ -1,18 +1,17 @@
|
|||||||
From 611a0dec7317fa0441a5923a8e825e804060c998 Mon Sep 17 00:00:00 2001
|
From a4f9b85c4ed1cc5128bcb6650cc8989310558769 Mon Sep 17 00:00:00 2001
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
Date: Thu, 27 Jul 2023 07:07:55 +0000
|
Date: Thu, 25 Nov 2021 12:06:31 +0800
|
||||||
Subject: [PATCH 04/15] fix memory leak
|
Subject: [PATCH 05/17] fix-memory-leak
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
---
|
||||||
src/proc_fuse.c | 8 +++++++-
|
src/proc_fuse.c | 8 +++++++-
|
||||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
||||||
index cde48ca..ed70ea7 100644
|
index 7372a36..bcd624d 100644
|
||||||
--- a/src/proc_fuse.c
|
--- a/src/proc_fuse.c
|
||||||
+++ b/src/proc_fuse.c
|
+++ b/src/proc_fuse.c
|
||||||
@@ -304,6 +304,8 @@ static uint64_t get_min_memlimit(const char *cgroup, bool swap)
|
@@ -278,6 +278,8 @@ static uint64_t get_min_memlimit(const char *cgroup, bool swap)
|
||||||
return log_error_errno(0, ENOMEM, "Failed to allocate memory");
|
return log_error_errno(0, ENOMEM, "Failed to allocate memory");
|
||||||
|
|
||||||
retlimit = get_memlimit(copy, swap);
|
retlimit = get_memlimit(copy, swap);
|
||||||
@ -21,7 +20,7 @@ index cde48ca..ed70ea7 100644
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* If the cgroup doesn't start with / (probably won't happen), dirname()
|
* If the cgroup doesn't start with / (probably won't happen), dirname()
|
||||||
@@ -409,6 +411,8 @@ static int proc_swaps_read(char *buf, size_t size, off_t offset,
|
@@ -346,6 +348,8 @@ static int proc_swaps_read(char *buf, size_t size, off_t offset,
|
||||||
prune_init_slice(cgroup);
|
prune_init_slice(cgroup);
|
||||||
|
|
||||||
memlimit = get_min_memlimit(cgroup, false);
|
memlimit = get_min_memlimit(cgroup, false);
|
||||||
@ -30,7 +29,7 @@ index cde48ca..ed70ea7 100644
|
|||||||
|
|
||||||
ret = cgroup_ops->get_memory_current(cgroup_ops, cgroup, &memusage_str);
|
ret = cgroup_ops->get_memory_current(cgroup_ops, cgroup, &memusage_str);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@@ -1453,6 +1457,8 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
|
@@ -1329,6 +1333,8 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
|
||||||
return read_file_fuse("/proc/meminfo", buf, size, d);
|
return read_file_fuse("/proc/meminfo", buf, size, d);
|
||||||
|
|
||||||
memlimit = get_min_memlimit(cgroup, false);
|
memlimit = get_min_memlimit(cgroup, false);
|
||||||
@ -39,7 +38,7 @@ index cde48ca..ed70ea7 100644
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Following values are allowed to fail, because swapaccount might be
|
* Following values are allowed to fail, because swapaccount might be
|
||||||
@@ -1467,9 +1473,9 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
|
@@ -1361,9 +1367,9 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
|
||||||
|
|
||||||
memusage /= 1024;
|
memusage /= 1024;
|
||||||
memlimit /= 1024;
|
memlimit /= 1024;
|
||||||
@ -51,5 +50,5 @@ index cde48ca..ed70ea7 100644
|
|||||||
memset(lbuf, 0, 100);
|
memset(lbuf, 0, 100);
|
||||||
if (startswith(line, "MemTotal:")) {
|
if (startswith(line, "MemTotal:")) {
|
||||||
--
|
--
|
||||||
2.41.0
|
2.27.0
|
||||||
|
|
||||||
@ -1,9 +1,8 @@
|
|||||||
From a7f9759ef8ce354ab2ad420d4a8c5b4260d491fc Mon Sep 17 00:00:00 2001
|
From 90fc9cd959bc6231eb3ddad5c74865d35e9f372d Mon Sep 17 00:00:00 2001
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
Date: Thu, 27 Jul 2023 07:24:18 +0000
|
Date: Thu, 25 Nov 2021 14:12:57 +0800
|
||||||
Subject: [PATCH 05/15] fix concurrency problem
|
Subject: [PATCH 06/17] fix-concurrency-problem
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
---
|
||||||
src/cgroups/cgroup_utils.c | 21 +++++++++++++--------
|
src/cgroups/cgroup_utils.c | 21 +++++++++++++--------
|
||||||
src/cgroups/cgroup_utils.h | 2 +-
|
src/cgroups/cgroup_utils.h | 2 +-
|
||||||
@ -81,10 +80,10 @@ index f431686..d4c8598 100644
|
|||||||
extern char *readat_file(int fd, const char *path);
|
extern char *readat_file(int fd, const char *path);
|
||||||
extern char *read_file_strip_newline(const char *fnam);
|
extern char *read_file_strip_newline(const char *fnam);
|
||||||
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
||||||
index ed70ea7..0af559f 100644
|
index bcd624d..0aaab71 100644
|
||||||
--- a/src/proc_fuse.c
|
--- a/src/proc_fuse.c
|
||||||
+++ b/src/proc_fuse.c
|
+++ b/src/proc_fuse.c
|
||||||
@@ -1747,6 +1747,9 @@ __lxcfs_fuse_ops int proc_read(const char *path, char *buf, size_t size,
|
@@ -1530,6 +1530,9 @@ __lxcfs_fuse_ops int proc_read(const char *path, char *buf, size_t size,
|
||||||
{
|
{
|
||||||
struct file_info *f = INTTYPE_TO_PTR(fi->fh);
|
struct file_info *f = INTTYPE_TO_PTR(fi->fh);
|
||||||
|
|
||||||
@ -95,5 +94,5 @@ index ed70ea7..0af559f 100644
|
|||||||
case LXC_TYPE_PROC_MEMINFO:
|
case LXC_TYPE_PROC_MEMINFO:
|
||||||
if (liblxcfs_functional())
|
if (liblxcfs_functional())
|
||||||
--
|
--
|
||||||
2.41.0
|
2.27.0
|
||||||
|
|
||||||
@ -1,20 +1,19 @@
|
|||||||
From 6a744fd9ba541e535e611f066c4038330605fe2b Mon Sep 17 00:00:00 2001
|
From 7691f5c4a87d5fbc0f48fa96bba70b4ab9b52c65 Mon Sep 17 00:00:00 2001
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
Date: Wed, 12 Jul 2023 07:48:40 +0000
|
Date: Thu, 25 Nov 2021 14:45:12 +0800
|
||||||
Subject: [PATCH 06/15] set null after free
|
Subject: [PATCH 07/17] set-null-after-free
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
---
|
||||||
src/cgroup_fuse.c | 27 ++++++++++++++++++++++-----
|
src/cgroup_fuse.c | 26 +++++++++++++++++++++-----
|
||||||
src/cgroups/cgfsng.c | 5 ++++-
|
src/cgroups/cgfsng.c | 5 ++++-
|
||||||
src/cgroups/cgroup_utils.c | 4 +++-
|
src/cgroups/cgroup_utils.c | 4 +++-
|
||||||
src/lxcfs.c | 4 ++++
|
src/lxcfs.c | 4 ++++
|
||||||
src/memory_utils.h | 4 +++-
|
src/memory_utils.h | 4 +++-
|
||||||
src/proc_loadavg.c | 5 ++++-
|
src/proc_loadavg.c | 5 ++++-
|
||||||
6 files changed, 40 insertions(+), 9 deletions(-)
|
6 files changed, 39 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/cgroup_fuse.c b/src/cgroup_fuse.c
|
diff --git a/src/cgroup_fuse.c b/src/cgroup_fuse.c
|
||||||
index 693b67d..0d4dd10 100644
|
index 5c22fd1..b396bbc 100644
|
||||||
--- a/src/cgroup_fuse.c
|
--- a/src/cgroup_fuse.c
|
||||||
+++ b/src/cgroup_fuse.c
|
+++ b/src/cgroup_fuse.c
|
||||||
@@ -179,7 +179,7 @@ static bool is_child_cgroup(const char *controller, const char *cgroup,
|
@@ -179,7 +179,7 @@ static bool is_child_cgroup(const char *controller, const char *cgroup,
|
||||||
@ -53,7 +52,7 @@ index 693b67d..0d4dd10 100644
|
|||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,6 +615,7 @@ __lxcfs_fuse_ops int cg_getattr(const char *path, struct stat *sb)
|
@@ -612,6 +614,7 @@ __lxcfs_fuse_ops int cg_getattr(const char *path, struct stat *sb)
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(cgdir);
|
free(cgdir);
|
||||||
@ -61,7 +60,7 @@ index 693b67d..0d4dd10 100644
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -735,7 +738,9 @@ __lxcfs_fuse_ops int cg_mkdir(const char *path, mode_t mode)
|
@@ -734,7 +737,9 @@ __lxcfs_fuse_ops int cg_mkdir(const char *path, mode_t mode)
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(cgdir);
|
free(cgdir);
|
||||||
@ -71,7 +70,7 @@ index 693b67d..0d4dd10 100644
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -870,7 +875,9 @@ __lxcfs_fuse_ops int cg_rmdir(const char *path)
|
@@ -869,7 +874,9 @@ __lxcfs_fuse_ops int cg_rmdir(const char *path)
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(cgdir);
|
free(cgdir);
|
||||||
@ -81,7 +80,7 @@ index 693b67d..0d4dd10 100644
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -959,6 +966,7 @@ __lxcfs_fuse_ops int cg_chmod(const char *path, mode_t mode)
|
@@ -958,6 +965,7 @@ __lxcfs_fuse_ops int cg_chmod(const char *path, mode_t mode)
|
||||||
out:
|
out:
|
||||||
free_key(k);
|
free_key(k);
|
||||||
free(cgdir);
|
free(cgdir);
|
||||||
@ -89,7 +88,7 @@ index 693b67d..0d4dd10 100644
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1068,7 +1076,7 @@ __lxcfs_fuse_ops int cg_chown(const char *path, uid_t uid, gid_t gid)
|
@@ -1067,7 +1075,7 @@ __lxcfs_fuse_ops int cg_chown(const char *path, uid_t uid, gid_t gid)
|
||||||
out:
|
out:
|
||||||
free_key(k);
|
free_key(k);
|
||||||
free(cgdir);
|
free(cgdir);
|
||||||
@ -98,7 +97,7 @@ index 693b67d..0d4dd10 100644
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1140,6 +1148,7 @@ __lxcfs_fuse_ops int cg_open(const char *path, struct fuse_file_info *fi)
|
@@ -1139,6 +1147,7 @@ __lxcfs_fuse_ops int cg_open(const char *path, struct fuse_file_info *fi)
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(cgdir);
|
free(cgdir);
|
||||||
@ -106,7 +105,7 @@ index 693b67d..0d4dd10 100644
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1281,6 +1290,7 @@ static bool do_read_pids(pid_t tpid, const char *contrl, const char *cg,
|
@@ -1280,6 +1289,7 @@ static bool do_read_pids(pid_t tpid, const char *contrl, const char *cg,
|
||||||
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sock) < 0) {
|
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sock) < 0) {
|
||||||
perror("socketpair");
|
perror("socketpair");
|
||||||
free(tmpdata);
|
free(tmpdata);
|
||||||
@ -114,7 +113,7 @@ index 693b67d..0d4dd10 100644
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1332,6 +1342,7 @@ next:
|
@@ -1331,6 +1341,7 @@ next:
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(tmpdata);
|
free(tmpdata);
|
||||||
@ -122,7 +121,7 @@ index 693b67d..0d4dd10 100644
|
|||||||
if (cpid != -1)
|
if (cpid != -1)
|
||||||
wait_for_pid(cpid);
|
wait_for_pid(cpid);
|
||||||
if (sock[0] != -1) {
|
if (sock[0] != -1) {
|
||||||
@@ -1409,6 +1420,7 @@ __lxcfs_fuse_ops int cg_read(const char *path, char *buf, size_t size,
|
@@ -1408,6 +1419,7 @@ __lxcfs_fuse_ops int cg_read(const char *path, char *buf, size_t size,
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(data);
|
free(data);
|
||||||
@ -130,15 +129,15 @@ index 693b67d..0d4dd10 100644
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1995,6 +2007,7 @@ __lxcfs_fuse_ops int cg_readdir(const char *path, void *buf,
|
@@ -1989,6 +2001,7 @@ __lxcfs_fuse_ops int cg_readdir(const char *path, void *buf,
|
||||||
if (nextcg) {
|
if (nextcg) {
|
||||||
ret = dir_filler(filler, buf, nextcg, 0);
|
ret = DIR_FILLER(filler, buf, nextcg, NULL, 0);
|
||||||
free(nextcg);
|
free(nextcg);
|
||||||
+ nextcg = NULL;
|
+ nextcg = NULL;
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
goto out;
|
goto out;
|
||||||
@@ -2030,9 +2043,12 @@ __lxcfs_fuse_ops int cg_readdir(const char *path, void *buf,
|
@@ -2024,8 +2037,10 @@ __lxcfs_fuse_ops int cg_readdir(const char *path, void *buf,
|
||||||
out:
|
out:
|
||||||
free_keys(list);
|
free_keys(list);
|
||||||
if (clist) {
|
if (clist) {
|
||||||
@ -148,11 +147,9 @@ index 693b67d..0d4dd10 100644
|
|||||||
+ clist[i] = NULL;
|
+ clist[i] = NULL;
|
||||||
+ }
|
+ }
|
||||||
free(clist);
|
free(clist);
|
||||||
+ clist = NULL;
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
@@ -2095,5 +2110,6 @@ __lxcfs_fuse_ops int cg_access(const char *path, int mode)
|
||||||
@@ -2101,5 +2117,6 @@ __lxcfs_fuse_ops int cg_access(const char *path, int mode)
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(cgdir);
|
free(cgdir);
|
||||||
@ -160,10 +157,10 @@ index 693b67d..0d4dd10 100644
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
diff --git a/src/cgroups/cgfsng.c b/src/cgroups/cgfsng.c
|
diff --git a/src/cgroups/cgfsng.c b/src/cgroups/cgfsng.c
|
||||||
index 72a4503..e2d9807 100644
|
index 3eb4227..781923c 100644
|
||||||
--- a/src/cgroups/cgfsng.c
|
--- a/src/cgroups/cgfsng.c
|
||||||
+++ b/src/cgroups/cgfsng.c
|
+++ b/src/cgroups/cgfsng.c
|
||||||
@@ -891,7 +891,7 @@ static int cg_hybrid_init(struct cgroup_ops *ops)
|
@@ -875,7 +875,7 @@ static int cg_hybrid_init(struct cgroup_ops *ops)
|
||||||
prune_init_scope(base_cgroup);
|
prune_init_scope(base_cgroup);
|
||||||
|
|
||||||
if (type == CGROUP2_SUPER_MAGIC) {
|
if (type == CGROUP2_SUPER_MAGIC) {
|
||||||
@ -172,7 +169,7 @@ index 72a4503..e2d9807 100644
|
|||||||
|
|
||||||
cgv2_ctrl_path = must_make_path(mountpoint, base_cgroup,
|
cgv2_ctrl_path = must_make_path(mountpoint, base_cgroup,
|
||||||
"cgroup.controllers",
|
"cgroup.controllers",
|
||||||
@@ -899,6 +899,7 @@ static int cg_hybrid_init(struct cgroup_ops *ops)
|
@@ -883,6 +883,7 @@ static int cg_hybrid_init(struct cgroup_ops *ops)
|
||||||
|
|
||||||
controller_list = cg_unified_get_controllers(cgv2_ctrl_path);
|
controller_list = cg_unified_get_controllers(cgv2_ctrl_path);
|
||||||
free(cgv2_ctrl_path);
|
free(cgv2_ctrl_path);
|
||||||
@ -180,7 +177,7 @@ index 72a4503..e2d9807 100644
|
|||||||
if (!controller_list)
|
if (!controller_list)
|
||||||
controller_list = cg_unified_make_empty_controller();
|
controller_list = cg_unified_make_empty_controller();
|
||||||
}
|
}
|
||||||
@@ -913,7 +914,9 @@ static int cg_hybrid_init(struct cgroup_ops *ops)
|
@@ -897,7 +898,9 @@ static int cg_hybrid_init(struct cgroup_ops *ops)
|
||||||
next:
|
next:
|
||||||
free_string_list(controller_list);
|
free_string_list(controller_list);
|
||||||
free(mountpoint);
|
free(mountpoint);
|
||||||
@ -216,10 +213,10 @@ index 1224971..d32a520 100644
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
diff --git a/src/lxcfs.c b/src/lxcfs.c
|
diff --git a/src/lxcfs.c b/src/lxcfs.c
|
||||||
index 92ed991..e9155ca 100644
|
index e24ebed..361ce71 100644
|
||||||
--- a/src/lxcfs.c
|
--- a/src/lxcfs.c
|
||||||
+++ b/src/lxcfs.c
|
+++ b/src/lxcfs.c
|
||||||
@@ -1357,10 +1357,12 @@ int main(int argc, char *argv[])
|
@@ -1237,10 +1237,12 @@ int main(int argc, char *argv[])
|
||||||
if (append_comma_separate(&new_fuse_opts, token)) {
|
if (append_comma_separate(&new_fuse_opts, token)) {
|
||||||
lxcfs_error("Failed to copy fuse argument \"%s\"", token);
|
lxcfs_error("Failed to copy fuse argument \"%s\"", token);
|
||||||
free(dup);
|
free(dup);
|
||||||
@ -232,7 +229,7 @@ index 92ed991..e9155ca 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (append_comma_separate(&new_fuse_opts, "allow_other,entry_timeout=0.5,attr_timeout=0.5")) {
|
if (append_comma_separate(&new_fuse_opts, "allow_other,entry_timeout=0.5,attr_timeout=0.5")) {
|
||||||
@@ -1426,7 +1428,9 @@ out:
|
@@ -1306,7 +1308,9 @@ out:
|
||||||
if (pidfile)
|
if (pidfile)
|
||||||
unlink(pidfile);
|
unlink(pidfile);
|
||||||
free(new_fuse_opts);
|
free(new_fuse_opts);
|
||||||
@ -243,7 +240,7 @@ index 92ed991..e9155ca 100644
|
|||||||
exit(ret);
|
exit(ret);
|
||||||
}
|
}
|
||||||
diff --git a/src/memory_utils.h b/src/memory_utils.h
|
diff --git a/src/memory_utils.h b/src/memory_utils.h
|
||||||
index c689c8e..13343e1 100644
|
index c689c8e..a7e4a58 100644
|
||||||
--- a/src/memory_utils.h
|
--- a/src/memory_utils.h
|
||||||
+++ b/src/memory_utils.h
|
+++ b/src/memory_utils.h
|
||||||
@@ -67,8 +67,10 @@ static inline void free_disarm_function(void *ptr)
|
@@ -67,8 +67,10 @@ static inline void free_disarm_function(void *ptr)
|
||||||
@ -259,7 +256,7 @@ index c689c8e..13343e1 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/proc_loadavg.c b/src/proc_loadavg.c
|
diff --git a/src/proc_loadavg.c b/src/proc_loadavg.c
|
||||||
index b7411c4..8cd1e02 100644
|
index 5f9bec7..c8daf35 100644
|
||||||
--- a/src/proc_loadavg.c
|
--- a/src/proc_loadavg.c
|
||||||
+++ b/src/proc_loadavg.c
|
+++ b/src/proc_loadavg.c
|
||||||
@@ -436,10 +436,13 @@ static int refresh_load(struct load_node *p, const char *path)
|
@@ -436,10 +436,13 @@ static int refresh_load(struct load_node *p, const char *path)
|
||||||
@ -278,5 +275,5 @@ index b7411c4..8cd1e02 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
--
|
--
|
||||||
2.41.0
|
2.27.0
|
||||||
|
|
||||||
@ -1,192 +0,0 @@
|
|||||||
From 0dded445efa7b53886081beab5b74facf0378287 Mon Sep 17 00:00:00 2001
|
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
Date: Thu, 27 Jul 2023 08:15:49 +0000
|
|
||||||
Subject: [PATCH 08/15] diskstats support devicemapper device
|
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
|
||||||
src/proc_fuse.c | 133 ++++++++++++++++++++++++++++++++++++++++++------
|
|
||||||
1 file changed, 117 insertions(+), 16 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
|
||||||
index e69e867..1f732ff 100644
|
|
||||||
--- a/src/proc_fuse.c
|
|
||||||
+++ b/src/proc_fuse.c
|
|
||||||
@@ -638,6 +638,15 @@ void free_devinfo_list(struct devinfo *ptr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+static bool need_record_diskstats(unsigned int major, unsigned int minor)
|
|
||||||
+{
|
|
||||||
+ // support device which major is 253 and 252
|
|
||||||
+ if (major == 253 || major == 252) {
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+ return false;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
struct lxcfs_diskstats {
|
|
||||||
unsigned int major; /* 1 - major number */
|
|
||||||
unsigned int minor; /* 2 - minor mumber */
|
|
||||||
@@ -680,6 +689,7 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
|
||||||
size_t linelen = 0, total_len = 0;
|
|
||||||
int i = 0;
|
|
||||||
int ret;
|
|
||||||
+ char tmp_dev_name[72];
|
|
||||||
|
|
||||||
if (offset) {
|
|
||||||
size_t left;
|
|
||||||
@@ -747,6 +757,7 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
|
||||||
while (getline(&line, &linelen, f) != -1) {
|
|
||||||
ssize_t l;
|
|
||||||
char lbuf[256];
|
|
||||||
+ bool match = false;
|
|
||||||
|
|
||||||
memset(stats.dev_name, 0, sizeof(stats.dev_name));
|
|
||||||
i = sscanf(line, "%u %u %71s", &stats.major, &stats.minor, stats.dev_name);
|
|
||||||
@@ -757,9 +768,14 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
|
||||||
if (stats.major == ptr->major && stats.minor == ptr->minor) {
|
|
||||||
snprintf(stats.dev_name, sizeof(stats.dev_name), "%s", ptr->name);
|
|
||||||
stats.dev_name[71] = '\0';
|
|
||||||
+ match = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (!match) {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
get_blkio_io_value(io_serviced_str, stats.major, stats.minor, "Read", &stats.read);
|
|
||||||
get_blkio_io_value(io_serviced_str, stats.major, stats.minor, "Write", &stats.write);
|
|
||||||
get_blkio_io_value(io_serviced_str, stats.major, stats.minor, "Discard", &stats.discard);
|
|
||||||
@@ -801,26 +817,111 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
|
||||||
stats.read_sectors || stats.write_sectors || stats.read_ticks ||
|
|
||||||
stats.write_ticks || stats.ios_pgr || stats.total_ticks || stats.rq_ticks || stats.discard ||
|
|
||||||
stats.discard_merged || stats.discard_sectors || stats.discard_ticks) {
|
|
||||||
+ if (need_record_diskstats(stats.major, stats.minor)) {
|
|
||||||
+ sscanf(line, "%u %u %71s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
|
||||||
+ &stats.major,
|
|
||||||
+ &stats.minor,
|
|
||||||
+ tmp_dev_name,
|
|
||||||
+ &stats.read,
|
|
||||||
+ &stats.read_merged,
|
|
||||||
+ &stats.read_sectors,
|
|
||||||
+ &stats.read_ticks,
|
|
||||||
+ &stats.write,
|
|
||||||
+ &stats.write_merged,
|
|
||||||
+ &stats.write_sectors,
|
|
||||||
+ &stats.write_ticks,
|
|
||||||
+ &stats.ios_pgr,
|
|
||||||
+ &stats.total_ticks,
|
|
||||||
+ &stats.rq_ticks,
|
|
||||||
+ &stats.discard,
|
|
||||||
+ &stats.discard_merged,
|
|
||||||
+ &stats.discard_sectors,
|
|
||||||
+ &stats.discard_ticks);
|
|
||||||
+ }
|
|
||||||
+ ret = strnprintf(
|
|
||||||
+ lbuf,
|
|
||||||
+ sizeof(lbuf),
|
|
||||||
+ "%u %u" /* major, minor */
|
|
||||||
+ " %s" /* dev_name */
|
|
||||||
+ " %" PRIu64 /* read */
|
|
||||||
+ " %" PRIu64 /* read_merged */
|
|
||||||
+ " %" PRIu64 /* read_sectors */
|
|
||||||
+ " %" PRIu64 /* read_ticks */
|
|
||||||
+ " %" PRIu64 /* write */
|
|
||||||
+ " %" PRIu64 /* write_merged */
|
|
||||||
+ " %" PRIu64 /* write_sectors */
|
|
||||||
+ " %" PRIu64 /* write_ticks */
|
|
||||||
+ " %" PRIu64 /* ios_pgr */
|
|
||||||
+ " %" PRIu64 /* total_ticks */
|
|
||||||
+ " %" PRIu64 /* rq_ticks */
|
|
||||||
+ " %" PRIu64 /* discard */
|
|
||||||
+ " %" PRIu64 /* discard_merged */
|
|
||||||
+ " %" PRIu64 /* discard_sectors */
|
|
||||||
+ " %" PRIu64 /* discard_ticks */
|
|
||||||
+ "\n",
|
|
||||||
+ stats.major,
|
|
||||||
+ stats.minor,
|
|
||||||
+ stats.dev_name,
|
|
||||||
+ stats.read,
|
|
||||||
+ stats.read_merged,
|
|
||||||
+ stats.read_sectors,
|
|
||||||
+ stats.read_ticks,
|
|
||||||
+ stats.write,
|
|
||||||
+ stats.write_merged,
|
|
||||||
+ stats.write_sectors,
|
|
||||||
+ stats.write_ticks,
|
|
||||||
+ stats.ios_pgr,
|
|
||||||
+ stats.total_ticks,
|
|
||||||
+ stats.rq_ticks,
|
|
||||||
+ stats.discard,
|
|
||||||
+ stats.discard_merged,
|
|
||||||
+ stats.discard_sectors,
|
|
||||||
+ stats.discard_ticks);
|
|
||||||
+ if (ret < 0) {
|
|
||||||
+ lxcfs_error("Insufficient buffer for %u:%u %s diskstats",
|
|
||||||
+ stats.major, stats.minor, stats.dev_name);
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ } else if (need_record_diskstats(stats.major, stats.minor)) {
|
|
||||||
+ sscanf(line, "%u %u %71s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
|
||||||
+ &stats.major,
|
|
||||||
+ &stats.minor,
|
|
||||||
+ tmp_dev_name,
|
|
||||||
+ &stats.read,
|
|
||||||
+ &stats.read_merged,
|
|
||||||
+ &stats.read_sectors,
|
|
||||||
+ &stats.read_ticks,
|
|
||||||
+ &stats.write,
|
|
||||||
+ &stats.write_merged,
|
|
||||||
+ &stats.write_sectors,
|
|
||||||
+ &stats.write_ticks,
|
|
||||||
+ &stats.ios_pgr,
|
|
||||||
+ &stats.total_ticks,
|
|
||||||
+ &stats.rq_ticks,
|
|
||||||
+ &stats.discard,
|
|
||||||
+ &stats.discard_merged,
|
|
||||||
+ &stats.discard_sectors,
|
|
||||||
+ &stats.discard_ticks);
|
|
||||||
ret = strnprintf(
|
|
||||||
lbuf,
|
|
||||||
sizeof(lbuf),
|
|
||||||
"%u %u" /* major, minor */
|
|
||||||
- " %s" /* dev_name */
|
|
||||||
- " %" PRIu64 /* read */
|
|
||||||
- " %" PRIu64 /* read_merged */
|
|
||||||
- " %" PRIu64 /* read_sectors */
|
|
||||||
- " %" PRIu64 /* read_ticks */
|
|
||||||
- " %" PRIu64 /* write */
|
|
||||||
- " %" PRIu64 /* write_merged */
|
|
||||||
- " %" PRIu64 /* write_sectors */
|
|
||||||
- " %" PRIu64 /* write_ticks */
|
|
||||||
- " %" PRIu64 /* ios_pgr */
|
|
||||||
- " %" PRIu64 /* total_ticks */
|
|
||||||
- " %" PRIu64 /* rq_ticks */
|
|
||||||
- " %" PRIu64 /* discard */
|
|
||||||
- " %" PRIu64 /* discard_merged */
|
|
||||||
- " %" PRIu64 /* discard_sectors */
|
|
||||||
- " %" PRIu64 /* discard_ticks */
|
|
||||||
+ " %s" /* dev_name */
|
|
||||||
+ " %" PRIu64 /* read */
|
|
||||||
+ " %" PRIu64 /* read_merged */
|
|
||||||
+ " %" PRIu64 /* read_sectors */
|
|
||||||
+ " %" PRIu64 /* read_ticks */
|
|
||||||
+ " %" PRIu64 /* write */
|
|
||||||
+ " %" PRIu64 /* write_merged */
|
|
||||||
+ " %" PRIu64 /* write_sectors */
|
|
||||||
+ " %" PRIu64 /* write_ticks */
|
|
||||||
+ " %" PRIu64 /* ios_pgr */
|
|
||||||
+ " %" PRIu64 /* total_ticks */
|
|
||||||
+ " %" PRIu64 /* rq_ticks */
|
|
||||||
+ " %" PRIu64 /* discard */
|
|
||||||
+ " %" PRIu64 /* discard_merged */
|
|
||||||
+ " %" PRIu64 /* discard_sectors */
|
|
||||||
+ " %" PRIu64 /* discard_ticks */
|
|
||||||
"\n",
|
|
||||||
stats.major,
|
|
||||||
stats.minor,
|
|
||||||
--
|
|
||||||
2.41.0
|
|
||||||
|
|
||||||
79
0008-fix-hang.patch
Normal file
79
0008-fix-hang.patch
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
From 0025ea3988eefdf9a7a0eff5d55d2524c105c485 Mon Sep 17 00:00:00 2001
|
||||||
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
|
Date: Thu, 25 Nov 2021 14:54:20 +0800
|
||||||
|
Subject: [PATCH 08/17] fix-hang
|
||||||
|
|
||||||
|
---
|
||||||
|
src/proc_fuse.c | 34 ++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 34 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
||||||
|
index 0aaab71..48c4e68 100644
|
||||||
|
--- a/src/proc_fuse.c
|
||||||
|
+++ b/src/proc_fuse.c
|
||||||
|
@@ -43,6 +43,26 @@
|
||||||
|
#include "proc_cpuview.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
+static pthread_mutex_t container_dev_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
+
|
||||||
|
+static void lock_mutex(pthread_mutex_t *l)
|
||||||
|
+{
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = pthread_mutex_lock(l);
|
||||||
|
+ if (ret)
|
||||||
|
+ log_exit("%s - returned %d\n", strerror(ret), ret);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void unlock_mutex(pthread_mutex_t *l)
|
||||||
|
+{
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = pthread_mutex_unlock(l);
|
||||||
|
+ if (ret)
|
||||||
|
+ log_exit("%s - returned %d\n", strerror(ret), ret);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
struct memory_stat {
|
||||||
|
uint64_t hierarchical_memory_limit;
|
||||||
|
uint64_t hierarchical_memsw_limit;
|
||||||
|
@@ -492,6 +512,16 @@ struct devinfo* container_dev_read(pid_t pid) {
|
||||||
|
return head;
|
||||||
|
}
|
||||||
|
if (child_pid == 0) {
|
||||||
|
+ /* Disallow signal reception in child process */
|
||||||
|
+ sigset_t oldset;
|
||||||
|
+ sigset_t newset;
|
||||||
|
+ sigemptyset(&newset);
|
||||||
|
+ sigaddset(&newset, SIGTERM);
|
||||||
|
+ sigaddset(&newset, SIGINT);
|
||||||
|
+ sigaddset(&newset, SIGHUP);
|
||||||
|
+ sigaddset(&newset, SIGQUIT);
|
||||||
|
+ sigprocmask(SIG_BLOCK,&newset,&oldset);
|
||||||
|
+
|
||||||
|
close(mypipe[0]);
|
||||||
|
stream = fdopen(mypipe[1], "w");
|
||||||
|
if (stream == NULL) {
|
||||||
|
@@ -538,6 +568,8 @@ child_out:
|
||||||
|
lxcfs_error("Error opening pipe for reading: %s\n", strerror(errno));
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
+ wait_for_pid(child_pid);
|
||||||
|
+ child_pid = 0;
|
||||||
|
while (fscanf(stream, "%100s%d", dev_name, &dev_num) == 2) {
|
||||||
|
if (dev_num == 0) {
|
||||||
|
break;
|
||||||
|
@@ -681,7 +713,9 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
|
if (!f)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
+ lock_mutex(&container_dev_mutex);
|
||||||
|
container_devinfo = container_dev_read(initpid);
|
||||||
|
+ unlock_mutex(&container_dev_mutex);
|
||||||
|
|
||||||
|
while (getline(&line, &linelen, f) != -1) {
|
||||||
|
ssize_t l;
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -1,18 +1,26 @@
|
|||||||
From a6e4ec48f7ad6e64eb95bcd46e8656f1cef95cfd Mon Sep 17 00:00:00 2001
|
From b0097ee3a4b0ac445271badac153293053bd03e1 Mon Sep 17 00:00:00 2001
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
Date: Wed, 12 Jul 2023 08:25:20 +0000
|
Date: Tue, 30 Nov 2021 15:10:23 +0800
|
||||||
Subject: [PATCH 07/15] limit stat by quota period setting
|
Subject: [PATCH 09/17] limit-stat-by-quota-period-setting
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
---
|
||||||
src/proc_fuse.c | 12 ++++++++++++
|
src/proc_fuse.c | 14 +++++++++++++-
|
||||||
1 file changed, 12 insertions(+)
|
1 file changed, 13 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
||||||
index 0af559f..e69e867 100644
|
index 48c4e68..c6c32c7 100644
|
||||||
--- a/src/proc_fuse.c
|
--- a/src/proc_fuse.c
|
||||||
+++ b/src/proc_fuse.c
|
+++ b/src/proc_fuse.c
|
||||||
@@ -1087,6 +1087,8 @@ static int proc_stat_read(char *buf, size_t size, off_t offset,
|
@@ -549,7 +549,7 @@ struct devinfo* container_dev_read(pid_t pid) {
|
||||||
|
memset(fpath, 0, sizeof(fpath));
|
||||||
|
snprintf(fpath, 99, "/dev/%s", ptr->d_name);
|
||||||
|
stat(fpath, &dev_stat);
|
||||||
|
- fprintf(stream, "%s %d ", ptr->d_name, dev_stat.st_rdev);
|
||||||
|
+ fprintf(stream, "%s %ld ", ptr->d_name, dev_stat.st_rdev);
|
||||||
|
fflush(stream);
|
||||||
|
}
|
||||||
|
closedir(dir);
|
||||||
|
@@ -1031,6 +1031,8 @@ static int proc_stat_read(char *buf, size_t size, off_t offset,
|
||||||
size_t linelen = 0, total_len = 0;
|
size_t linelen = 0, total_len = 0;
|
||||||
int curcpu = -1; /* cpu numbering starts at 0 */
|
int curcpu = -1; /* cpu numbering starts at 0 */
|
||||||
int physcpu = 0;
|
int physcpu = 0;
|
||||||
@ -21,7 +29,7 @@ index 0af559f..e69e867 100644
|
|||||||
uint64_t user = 0, nice = 0, system = 0, idle = 0, iowait = 0, irq = 0,
|
uint64_t user = 0, nice = 0, system = 0, idle = 0, iowait = 0, irq = 0,
|
||||||
softirq = 0, steal = 0, guest = 0, guest_nice = 0;
|
softirq = 0, steal = 0, guest = 0, guest_nice = 0;
|
||||||
uint64_t user_sum = 0, nice_sum = 0, system_sum = 0, idle_sum = 0,
|
uint64_t user_sum = 0, nice_sum = 0, system_sum = 0, idle_sum = 0,
|
||||||
@@ -1138,6 +1140,13 @@ static int proc_stat_read(char *buf, size_t size, off_t offset,
|
@@ -1079,6 +1081,13 @@ static int proc_stat_read(char *buf, size_t size, off_t offset,
|
||||||
if (!cpuset)
|
if (!cpuset)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -30,12 +38,12 @@ index 0af559f..e69e867 100644
|
|||||||
+ else
|
+ else
|
||||||
+ use_view = false;
|
+ use_view = false;
|
||||||
+ if (use_view)
|
+ if (use_view)
|
||||||
+ max_cpus = max_cpu_count(cg, cpu_cg);
|
+ max_cpus = max_cpu_count(cg);
|
||||||
+
|
+
|
||||||
f = fopen_cached("/proc/stat", "re", &fopen_cache);
|
f = fopen_cached("/proc/stat", "re", &fopen_cache);
|
||||||
if (!f)
|
if (!f)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1186,6 +1195,9 @@ static int proc_stat_read(char *buf, size_t size, off_t offset,
|
@@ -1127,6 +1136,9 @@ static int proc_stat_read(char *buf, size_t size, off_t offset,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,5 +54,5 @@ index 0af559f..e69e867 100644
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
--
|
--
|
||||||
2.41.0
|
2.27.0
|
||||||
|
|
||||||
111
0010-diskstats-support-devicemapper-device.patch
Normal file
111
0010-diskstats-support-devicemapper-device.patch
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
From 784830ba0066dae7a181df2b82795dda57427127 Mon Sep 17 00:00:00 2001
|
||||||
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
|
Date: Tue, 30 Nov 2021 15:23:01 +0800
|
||||||
|
Subject: [PATCH 10/17] diskstats-support-devicemapper-device
|
||||||
|
|
||||||
|
---
|
||||||
|
src/proc_fuse.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||||
|
1 file changed, 55 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
||||||
|
index c6c32c7..a613688 100644
|
||||||
|
--- a/src/proc_fuse.c
|
||||||
|
+++ b/src/proc_fuse.c
|
||||||
|
@@ -611,6 +611,15 @@ void free_devinfo_list(struct devinfo *ptr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+static bool need_record_diskstats(unsigned int major, unsigned int minor)
|
||||||
|
+{
|
||||||
|
+ // support device which major is 253 and 252
|
||||||
|
+ if (major == 253 || major == 252) {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ return false;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
struct lxcfs_diskstats {
|
||||||
|
unsigned int major; /* 1 - major number */
|
||||||
|
unsigned int minor; /* 2 - minor mumber */
|
||||||
|
@@ -653,6 +662,7 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
|
size_t linelen = 0, total_len = 0;
|
||||||
|
int i = 0;
|
||||||
|
int ret;
|
||||||
|
+ char tmp_dev_name[72];
|
||||||
|
|
||||||
|
if (offset) {
|
||||||
|
size_t left;
|
||||||
|
@@ -720,6 +730,7 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
|
while (getline(&line, &linelen, f) != -1) {
|
||||||
|
ssize_t l;
|
||||||
|
char lbuf[256];
|
||||||
|
+ bool match = false;
|
||||||
|
|
||||||
|
memset(stats.dev_name, 0, sizeof(stats.dev_name));
|
||||||
|
i = sscanf(line, "%u %u %71s", &stats.major, &stats.minor, stats.dev_name);
|
||||||
|
@@ -729,9 +740,14 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
|
if (stats.major == ptr->major && stats.minor == ptr->minor) {
|
||||||
|
snprintf(stats.dev_name, sizeof(stats.dev_name), "%s", ptr->name);
|
||||||
|
stats.dev_name[71] = '\0';
|
||||||
|
+ match = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (!match) {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
get_blkio_io_value(io_serviced_str, stats.major, stats.minor, "Read", &stats.read);
|
||||||
|
get_blkio_io_value(io_serviced_str, stats.major, stats.minor, "Write", &stats.write);
|
||||||
|
get_blkio_io_value(io_serviced_str, stats.major, stats.minor, "Discard", &stats.discard);
|
||||||
|
@@ -791,8 +807,46 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
|
stats.discard_merged,
|
||||||
|
stats.discard_sectors,
|
||||||
|
stats.discard_ticks);
|
||||||
|
- else
|
||||||
|
+ else if (need_record_diskstats(stats.major, stats.minor)) {
|
||||||
|
+ sscanf(line, "%u %u %71s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||||
|
+ &stats.major,
|
||||||
|
+ &stats.minor,
|
||||||
|
+ tmp_dev_name,
|
||||||
|
+ &stats.read,
|
||||||
|
+ &stats.read_merged,
|
||||||
|
+ &stats.read_sectors,
|
||||||
|
+ &stats.read_ticks,
|
||||||
|
+ &stats.write,
|
||||||
|
+ &stats.write_merged,
|
||||||
|
+ &stats.write_sectors,
|
||||||
|
+ &stats.write_ticks,
|
||||||
|
+ &stats.ios_pgr,
|
||||||
|
+ &stats.total_ticks,
|
||||||
|
+ &stats.rq_ticks,
|
||||||
|
+ &stats.discard_merged,
|
||||||
|
+ &stats.discard_sectors,
|
||||||
|
+ &stats.discard_ticks);
|
||||||
|
+ snprintf(lbuf, 256, "%u %u %s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||||
|
+ stats.major,
|
||||||
|
+ stats.minor,
|
||||||
|
+ stats.dev_name,
|
||||||
|
+ stats.read,
|
||||||
|
+ stats.read_merged,
|
||||||
|
+ stats.read_sectors,
|
||||||
|
+ stats.read_ticks,
|
||||||
|
+ stats.write,
|
||||||
|
+ stats.write_merged,
|
||||||
|
+ stats.write_sectors,
|
||||||
|
+ stats.write_ticks,
|
||||||
|
+ stats.ios_pgr,
|
||||||
|
+ stats.total_ticks,
|
||||||
|
+ stats.rq_ticks,
|
||||||
|
+ stats.discard_merged,
|
||||||
|
+ stats.discard_sectors,
|
||||||
|
+ stats.discard_ticks);
|
||||||
|
+ } else {
|
||||||
|
continue;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
l = snprintf(cache, cache_size, "%s", lbuf);
|
||||||
|
if (l < 0) {
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
From cd4988df0a9f7140758c0429485322dc6d9467d5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
Date: Fri, 14 Jul 2023 07:54:27 +0000
|
|
||||||
Subject: [PATCH 11/15] add secure compile option in meson
|
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
|
||||||
Makefile | 2 +-
|
|
||||||
meson.build | 4 ++++
|
|
||||||
2 files changed, 5 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/Makefile b/Makefile
|
|
||||||
index 94f2021..38fbe04 100644
|
|
||||||
--- a/Makefile
|
|
||||||
+++ b/Makefile
|
|
||||||
@@ -2,7 +2,7 @@
|
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
all: meson
|
|
||||||
- ninja -C build
|
|
||||||
+ ninja -v -C build
|
|
||||||
|
|
||||||
.PHONY: meson
|
|
||||||
meson:
|
|
||||||
diff --git a/meson.build b/meson.build
|
|
||||||
index a0289ad..7eb1f06 100644
|
|
||||||
--- a/meson.build
|
|
||||||
+++ b/meson.build
|
|
||||||
@@ -12,6 +12,7 @@ project(
|
|
||||||
'b_pie=true',
|
|
||||||
'c_std=gnu11',
|
|
||||||
'warning_level=2',
|
|
||||||
+ 'optimization=2',
|
|
||||||
],
|
|
||||||
meson_version: '>= 0.50')
|
|
||||||
|
|
||||||
@@ -109,6 +110,9 @@ possible_cc_flags = [
|
|
||||||
'-Wreturn-local-addr',
|
|
||||||
'-fsanitize=cfi',
|
|
||||||
'-Wstringop-overflow',
|
|
||||||
+ '-ftrapv',
|
|
||||||
+ '-fPIC',
|
|
||||||
+ '-D_FORTIFY_SOURCE=2',
|
|
||||||
]
|
|
||||||
|
|
||||||
possible_link_flags = [
|
|
||||||
--
|
|
||||||
2.41.0
|
|
||||||
|
|
||||||
@ -1,33 +1,32 @@
|
|||||||
From f230a8816877cc803d52661a444cb6d1b9d55f96 Mon Sep 17 00:00:00 2001
|
From f4486dde281016cda897f1564dcb8ca0303f2fbf Mon Sep 17 00:00:00 2001
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
Date: Thu, 27 Jul 2023 08:28:00 +0000
|
Date: Thu, 25 Nov 2021 16:01:12 +0800
|
||||||
Subject: [PATCH 09/15] lxcfs add proc partitions
|
Subject: [PATCH 11/17] lxcfs-add-proc-partitions
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
---
|
||||||
src/bindings.h | 3 ++
|
src/bindings.h | 3 ++
|
||||||
src/proc_fuse.c | 137 ++++++++++++++++++++++++++++++++++++++++++++----
|
src/proc_fuse.c | 131 +++++++++++++++++++++++++++++++++++++++++++++---
|
||||||
2 files changed, 131 insertions(+), 9 deletions(-)
|
2 files changed, 126 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/bindings.h b/src/bindings.h
|
diff --git a/src/bindings.h b/src/bindings.h
|
||||||
index 8d9d6eb..fcf408a 100644
|
index cd7d466..91d44c7 100644
|
||||||
--- a/src/bindings.h
|
--- a/src/bindings.h
|
||||||
+++ b/src/bindings.h
|
+++ b/src/bindings.h
|
||||||
@@ -60,6 +60,9 @@ enum lxcfs_virt_t {
|
@@ -55,6 +55,9 @@ enum lxcfs_virt_t {
|
||||||
LXC_TYPE_PROC_SLABINFO,
|
LXC_TYPE_PROC_LOADAVG,
|
||||||
#define LXC_TYPE_PROC_SLABINFO_PATH "/proc/slabinfo"
|
#define LXC_TYPE_PROC_LOADAVG_PATH "/proc/loadavg"
|
||||||
|
|
||||||
+ LXC_TYPE_PROC_PARTITIONS,
|
+ LXC_TYPE_PROC_PARTITIONS,
|
||||||
+#define LXC_TYPE_PROC_PARTITIONS_PATH "/proc/partitions"
|
+#define LXC_TYPE_PROC_PARTITIONS_PATH "/proc/partitions"
|
||||||
+
|
+
|
||||||
LXC_TYPE_SYS,
|
|
||||||
LXC_TYPE_SYS_DEVICES,
|
LXC_TYPE_SYS_DEVICES,
|
||||||
LXC_TYPE_SYS_DEVICES_SYSTEM,
|
LXC_TYPE_SYS_DEVICES_SYSTEM,
|
||||||
|
LXC_TYPE_SYS_DEVICES_SYSTEM_CPU,
|
||||||
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
||||||
index 1f732ff..0dbbefe 100644
|
index a613688..72f6de6 100644
|
||||||
--- a/src/proc_fuse.c
|
--- a/src/proc_fuse.c
|
||||||
+++ b/src/proc_fuse.c
|
+++ b/src/proc_fuse.c
|
||||||
@@ -119,14 +119,15 @@ __lxcfs_fuse_ops int proc_getattr(const char *path, struct stat *sb)
|
@@ -118,13 +118,14 @@ __lxcfs_fuse_ops int proc_getattr(const char *path, struct stat *sb)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,8 +36,7 @@ index 1f732ff..0dbbefe 100644
|
|||||||
- strcmp(path, "/proc/stat") == 0 ||
|
- strcmp(path, "/proc/stat") == 0 ||
|
||||||
- strcmp(path, "/proc/diskstats") == 0 ||
|
- strcmp(path, "/proc/diskstats") == 0 ||
|
||||||
- strcmp(path, "/proc/swaps") == 0 ||
|
- strcmp(path, "/proc/swaps") == 0 ||
|
||||||
- strcmp(path, "/proc/loadavg") == 0 ||
|
- strcmp(path, "/proc/loadavg") == 0) {
|
||||||
- strcmp(path, "/proc/slabinfo") == 0) {
|
|
||||||
+ if (strcmp(path, "/proc/meminfo") == 0 ||
|
+ if (strcmp(path, "/proc/meminfo") == 0 ||
|
||||||
+ strcmp(path, "/proc/cpuinfo") == 0 ||
|
+ strcmp(path, "/proc/cpuinfo") == 0 ||
|
||||||
+ strcmp(path, "/proc/uptime") == 0 ||
|
+ strcmp(path, "/proc/uptime") == 0 ||
|
||||||
@ -46,31 +44,30 @@ index 1f732ff..0dbbefe 100644
|
|||||||
+ strcmp(path, "/proc/diskstats") == 0 ||
|
+ strcmp(path, "/proc/diskstats") == 0 ||
|
||||||
+ strcmp(path, "/proc/swaps") == 0 ||
|
+ strcmp(path, "/proc/swaps") == 0 ||
|
||||||
+ strcmp(path, "/proc/loadavg") == 0 ||
|
+ strcmp(path, "/proc/loadavg") == 0 ||
|
||||||
+ strcmp(path, "/proc/slabinfo") == 0 ||
|
|
||||||
+ strcmp(path, "/proc/partitions") == 0) {
|
+ strcmp(path, "/proc/partitions") == 0) {
|
||||||
sb->st_size = get_procfile_size(path);
|
sb->st_size = get_procfile_size(path);
|
||||||
sb->st_mode = S_IFREG | 00444;
|
sb->st_mode = S_IFREG | 00444;
|
||||||
sb->st_nlink = 1;
|
sb->st_nlink = 1;
|
||||||
@@ -149,7 +150,8 @@ __lxcfs_fuse_ops int proc_readdir(const char *path, void *buf,
|
@@ -146,7 +147,8 @@ __lxcfs_fuse_ops int proc_readdir(const char *path, void *buf,
|
||||||
dir_filler(filler, buf, "diskstats", 0) != 0 ||
|
DIR_FILLER(filler, buf, "uptime", NULL, 0) != 0 ||
|
||||||
dir_filler(filler, buf, "swaps", 0) != 0 ||
|
DIR_FILLER(filler, buf, "diskstats", NULL, 0) != 0 ||
|
||||||
dir_filler(filler, buf, "loadavg", 0) != 0 ||
|
DIR_FILLER(filler, buf, "swaps", NULL, 0) != 0 ||
|
||||||
- dir_filler(filler, buf, "slabinfo", 0) != 0)
|
- DIR_FILLER(filler, buf, "loadavg", NULL, 0) != 0)
|
||||||
+ dir_filler(filler, buf, "slabinfo", 0) != 0 ||
|
+ DIR_FILLER(filler, buf, "loadavg", NULL, 0) != 0 ||
|
||||||
+ dir_filler(filler, buf, "partitions", 0) != 0)
|
+ DIR_FILLER(filler, buf, "partitions", NULL, 0) != 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -176,6 +178,8 @@ __lxcfs_fuse_ops int proc_open(const char *path, struct fuse_file_info *fi)
|
@@ -171,6 +173,8 @@ __lxcfs_fuse_ops int proc_open(const char *path, struct fuse_file_info *fi)
|
||||||
|
type = LXC_TYPE_PROC_SWAPS;
|
||||||
|
else if (strcmp(path, "/proc/loadavg") == 0)
|
||||||
type = LXC_TYPE_PROC_LOADAVG;
|
type = LXC_TYPE_PROC_LOADAVG;
|
||||||
else if (strcmp(path, "/proc/slabinfo") == 0)
|
|
||||||
type = LXC_TYPE_PROC_SLABINFO;
|
|
||||||
+ else if (strcmp(path, "/proc/partitions") == 0)
|
+ else if (strcmp(path, "/proc/partitions") == 0)
|
||||||
+ type = LXC_TYPE_PROC_PARTITIONS;
|
+ type = LXC_TYPE_PROC_PARTITIONS;
|
||||||
if (type == -1)
|
if (type == -1)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
@@ -975,6 +979,115 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
@@ -872,6 +876,111 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
return total_len;
|
return total_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,18 +91,14 @@ index 1f732ff..0dbbefe 100644
|
|||||||
+ FILE *f = NULL;
|
+ FILE *f = NULL;
|
||||||
+
|
+
|
||||||
+ if (offset > 0){
|
+ if (offset > 0){
|
||||||
+ size_t left;
|
|
||||||
+
|
|
||||||
+ if (offset > d->size)
|
+ if (offset > d->size)
|
||||||
+ return -EINVAL;
|
+ return -EINVAL;
|
||||||
+
|
+ if (d->cached == 0)
|
||||||
+ if (!d->cached)
|
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+
|
+ int left = d->size - offset;
|
||||||
+ left = d->size - offset;
|
|
||||||
+ total_len = left > size ? size: left;
|
+ total_len = left > size ? size: left;
|
||||||
+ memcpy(buf, cache + offset, total_len);
|
|
||||||
+
|
+
|
||||||
|
+ memcpy(buf, cache + offset, total_len);
|
||||||
+ return total_len;
|
+ return total_len;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -155,7 +148,7 @@ index 1f732ff..0dbbefe 100644
|
|||||||
+ rv = 0;
|
+ rv = 0;
|
||||||
+ goto err;
|
+ goto err;
|
||||||
+ }
|
+ }
|
||||||
+ if ((size_t)l >= cache_size) {
|
+ if (l >= cache_size) {
|
||||||
+ lxcfs_error("%s\n", "Internal error: truncated write to cache.");
|
+ lxcfs_error("%s\n", "Internal error: truncated write to cache.");
|
||||||
+ rv = 0;
|
+ rv = 0;
|
||||||
+ goto err;
|
+ goto err;
|
||||||
@ -186,9 +179,9 @@ index 1f732ff..0dbbefe 100644
|
|||||||
#ifdef RELOADTEST
|
#ifdef RELOADTEST
|
||||||
static inline void iwashere(void)
|
static inline void iwashere(void)
|
||||||
{
|
{
|
||||||
@@ -1912,6 +2025,12 @@ __lxcfs_fuse_ops int proc_read(const char *path, char *buf, size_t size,
|
@@ -1676,6 +1785,12 @@ __lxcfs_fuse_ops int proc_read(const char *path, char *buf, size_t size,
|
||||||
|
|
||||||
return read_file_fuse_with_offset(LXC_TYPE_PROC_SLABINFO_PATH,
|
return read_file_fuse_with_offset(LXC_TYPE_PROC_LOADAVG_PATH,
|
||||||
buf, size, offset, f);
|
buf, size, offset, f);
|
||||||
+ case LXC_TYPE_PROC_PARTITIONS:
|
+ case LXC_TYPE_PROC_PARTITIONS:
|
||||||
+ if(liblxcfs_functional())
|
+ if(liblxcfs_functional())
|
||||||
@ -200,5 +193,5 @@ index 1f732ff..0dbbefe 100644
|
|||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
--
|
--
|
||||||
2.41.0
|
2.27.0
|
||||||
|
|
||||||
@ -1,18 +1,17 @@
|
|||||||
From d7582ba91869e19936c76f4d63b803d82d8e1caf Mon Sep 17 00:00:00 2001
|
From a0d132e43d22153908e392b8274570bacd9cb6ce Mon Sep 17 00:00:00 2001
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
Date: Wed, 12 Jul 2023 08:53:42 +0000
|
Date: Thu, 25 Nov 2021 16:10:39 +0800
|
||||||
Subject: [PATCH 10/15] lxcfs proc_diskstats_read func obtain data from blki
|
Subject: [PATCH 12/17] lxcfs-proc_diskstats_read-func-obtain-data-from-blki
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
---
|
||||||
src/cgroups/cgfsng.c | 12 ++++++++++--
|
src/cgroups/cgfsng.c | 12 ++++++++++--
|
||||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/cgroups/cgfsng.c b/src/cgroups/cgfsng.c
|
diff --git a/src/cgroups/cgfsng.c b/src/cgroups/cgfsng.c
|
||||||
index e2d9807..15b4539 100644
|
index 781923c..e50c87d 100644
|
||||||
--- a/src/cgroups/cgfsng.c
|
--- a/src/cgroups/cgfsng.c
|
||||||
+++ b/src/cgroups/cgfsng.c
|
+++ b/src/cgroups/cgfsng.c
|
||||||
@@ -767,7 +767,11 @@ static int cgfsng_get_io(struct cgroup_ops *ops, const char *cgroup,
|
@@ -751,7 +751,11 @@ static int cgfsng_get_io(struct cgroup_ops *ops, const char *cgroup,
|
||||||
static int cgfsng_get_io_service_bytes(struct cgroup_ops *ops,
|
static int cgfsng_get_io_service_bytes(struct cgroup_ops *ops,
|
||||||
const char *cgroup, char **value)
|
const char *cgroup, char **value)
|
||||||
{
|
{
|
||||||
@ -25,7 +24,7 @@ index e2d9807..15b4539 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int cgfsng_get_io_service_time(struct cgroup_ops *ops,
|
static int cgfsng_get_io_service_time(struct cgroup_ops *ops,
|
||||||
@@ -779,7 +783,11 @@ static int cgfsng_get_io_service_time(struct cgroup_ops *ops,
|
@@ -763,7 +767,11 @@ static int cgfsng_get_io_service_time(struct cgroup_ops *ops,
|
||||||
static int cgfsng_get_io_serviced(struct cgroup_ops *ops, const char *cgroup,
|
static int cgfsng_get_io_serviced(struct cgroup_ops *ops, const char *cgroup,
|
||||||
char **value)
|
char **value)
|
||||||
{
|
{
|
||||||
@ -39,5 +38,5 @@ index e2d9807..15b4539 100644
|
|||||||
|
|
||||||
static int cgfsng_get_io_merged(struct cgroup_ops *ops, const char *cgroup,
|
static int cgfsng_get_io_merged(struct cgroup_ops *ops, const char *cgroup,
|
||||||
--
|
--
|
||||||
2.41.0
|
2.27.0
|
||||||
|
|
||||||
25
0013-add-secure-compile-option-in-Makefile.patch
Normal file
25
0013-add-secure-compile-option-in-Makefile.patch
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
From cc7fb353c259830179c7371afb7b141c0f8290ae Mon Sep 17 00:00:00 2001
|
||||||
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
|
Date: Thu, 25 Nov 2021 16:48:55 +0800
|
||||||
|
Subject: [PATCH 13/17] add-secure-compile-option-in-Makefile
|
||||||
|
|
||||||
|
---
|
||||||
|
src/Makefile.am | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||||
|
index 2734334..437a377 100644
|
||||||
|
--- a/src/Makefile.am
|
||||||
|
+++ b/src/Makefile.am
|
||||||
|
@@ -6,6 +6,8 @@ AM_LDFLAGS = $(FUSE_LIBS) -pthread
|
||||||
|
#AM_CFLAGS += -DVERBOSE
|
||||||
|
|
||||||
|
AM_CFLAGS += -DRUNTIME_PATH=\"$(RUNTIME_PATH)\"
|
||||||
|
+AM_CFLAGS += -Wl,-z,now -fPIE
|
||||||
|
+AM_LDFLAGS += -Wl,-z,now -pie
|
||||||
|
|
||||||
|
liblxcfs_la_SOURCES = api_extensions.h \
|
||||||
|
bindings.c bindings.h \
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
128
0014-fix-proc-diskstats-show-in-container.patch
Normal file
128
0014-fix-proc-diskstats-show-in-container.patch
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
From 6710b6d777e4e25b1ce78a4cb9736e7e65f15aa2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
|
Date: Tue, 30 Nov 2021 15:26:26 +0800
|
||||||
|
Subject: [PATCH 14/17] fix-proc-diskstats-show-in-container
|
||||||
|
|
||||||
|
---
|
||||||
|
src/proc_fuse.c | 98 +++++++++++++++++++++++++++++--------------------
|
||||||
|
1 file changed, 59 insertions(+), 39 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
||||||
|
index 72f6de6..0d5ba89 100644
|
||||||
|
--- a/src/proc_fuse.c
|
||||||
|
+++ b/src/proc_fuse.c
|
||||||
|
@@ -792,7 +792,64 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
|
if (stats.read || stats.write || stats.read_merged || stats.write_merged ||
|
||||||
|
stats.read_sectors || stats.write_sectors || stats.read_ticks ||
|
||||||
|
stats.write_ticks || stats.ios_pgr || stats.total_ticks || stats.rq_ticks ||
|
||||||
|
- stats.discard_merged || stats.discard_sectors || stats.discard_ticks)
|
||||||
|
+ stats.discard_merged || stats.discard_sectors || stats.discard_ticks) {
|
||||||
|
+ if (need_record_diskstats(stats.major, stats.minor)) {
|
||||||
|
+ sscanf(line, "%u %u %71s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||||
|
+ &stats.major,
|
||||||
|
+ &stats.minor,
|
||||||
|
+ tmp_dev_name,
|
||||||
|
+ &stats.read,
|
||||||
|
+ &stats.read_merged,
|
||||||
|
+ &stats.read_sectors,
|
||||||
|
+ &stats.read_ticks,
|
||||||
|
+ &stats.write,
|
||||||
|
+ &stats.write_merged,
|
||||||
|
+ &stats.write_sectors,
|
||||||
|
+ &stats.write_ticks,
|
||||||
|
+ &stats.ios_pgr,
|
||||||
|
+ &stats.total_ticks,
|
||||||
|
+ &stats.rq_ticks,
|
||||||
|
+ &stats.discard_merged,
|
||||||
|
+ &stats.discard_sectors,
|
||||||
|
+ &stats.discard_ticks);
|
||||||
|
+ }
|
||||||
|
+ snprintf(lbuf, 256, "%u %u %s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||||
|
+ stats.major,
|
||||||
|
+ stats.minor,
|
||||||
|
+ stats.dev_name,
|
||||||
|
+ stats.read,
|
||||||
|
+ stats.read_merged,
|
||||||
|
+ stats.read_sectors,
|
||||||
|
+ stats.read_ticks,
|
||||||
|
+ stats.write,
|
||||||
|
+ stats.write_merged,
|
||||||
|
+ stats.write_sectors,
|
||||||
|
+ stats.write_ticks,
|
||||||
|
+ stats.ios_pgr,
|
||||||
|
+ stats.total_ticks,
|
||||||
|
+ stats.rq_ticks,
|
||||||
|
+ stats.discard_merged,
|
||||||
|
+ stats.discard_sectors,
|
||||||
|
+ stats.discard_ticks);
|
||||||
|
+ } else if (need_record_diskstats(stats.major, stats.minor)) {
|
||||||
|
+ sscanf(line, "%u %u %71s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||||
|
+ &stats.major,
|
||||||
|
+ &stats.minor,
|
||||||
|
+ tmp_dev_name,
|
||||||
|
+ &stats.read,
|
||||||
|
+ &stats.read_merged,
|
||||||
|
+ &stats.read_sectors,
|
||||||
|
+ &stats.read_ticks,
|
||||||
|
+ &stats.write,
|
||||||
|
+ &stats.write_merged,
|
||||||
|
+ &stats.write_sectors,
|
||||||
|
+ &stats.write_ticks,
|
||||||
|
+ &stats.ios_pgr,
|
||||||
|
+ &stats.total_ticks,
|
||||||
|
+ &stats.rq_ticks,
|
||||||
|
+ &stats.discard_merged,
|
||||||
|
+ &stats.discard_sectors,
|
||||||
|
+ &stats.discard_ticks);
|
||||||
|
snprintf(lbuf, 256, "%u %u %s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||||
|
stats.major,
|
||||||
|
stats.minor,
|
||||||
|
@@ -811,44 +868,7 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
|
stats.discard_merged,
|
||||||
|
stats.discard_sectors,
|
||||||
|
stats.discard_ticks);
|
||||||
|
- else if (need_record_diskstats(stats.major, stats.minor)) {
|
||||||
|
- sscanf(line, "%u %u %71s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||||
|
- &stats.major,
|
||||||
|
- &stats.minor,
|
||||||
|
- tmp_dev_name,
|
||||||
|
- &stats.read,
|
||||||
|
- &stats.read_merged,
|
||||||
|
- &stats.read_sectors,
|
||||||
|
- &stats.read_ticks,
|
||||||
|
- &stats.write,
|
||||||
|
- &stats.write_merged,
|
||||||
|
- &stats.write_sectors,
|
||||||
|
- &stats.write_ticks,
|
||||||
|
- &stats.ios_pgr,
|
||||||
|
- &stats.total_ticks,
|
||||||
|
- &stats.rq_ticks,
|
||||||
|
- &stats.discard_merged,
|
||||||
|
- &stats.discard_sectors,
|
||||||
|
- &stats.discard_ticks);
|
||||||
|
- snprintf(lbuf, 256, "%u %u %s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||||
|
- stats.major,
|
||||||
|
- stats.minor,
|
||||||
|
- stats.dev_name,
|
||||||
|
- stats.read,
|
||||||
|
- stats.read_merged,
|
||||||
|
- stats.read_sectors,
|
||||||
|
- stats.read_ticks,
|
||||||
|
- stats.write,
|
||||||
|
- stats.write_merged,
|
||||||
|
- stats.write_sectors,
|
||||||
|
- stats.write_ticks,
|
||||||
|
- stats.ios_pgr,
|
||||||
|
- stats.total_ticks,
|
||||||
|
- stats.rq_ticks,
|
||||||
|
- stats.discard_merged,
|
||||||
|
- stats.discard_sectors,
|
||||||
|
- stats.discard_ticks);
|
||||||
|
- } else {
|
||||||
|
+ } else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
From c79ce840026f83a8582d31e5e80529f0c230126c Mon Sep 17 00:00:00 2001
|
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
Date: Thu, 27 Jul 2023 09:18:15 +0000
|
|
||||||
Subject: [PATCH 15/15] adapt meson build & install
|
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
|
||||||
Makefile | 2 +-
|
|
||||||
config/init/meson.build | 1 +
|
|
||||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/Makefile b/Makefile
|
|
||||||
index 38fbe04..891d7ad 100644
|
|
||||||
--- a/Makefile
|
|
||||||
+++ b/Makefile
|
|
||||||
@@ -6,7 +6,7 @@ all: meson
|
|
||||||
|
|
||||||
.PHONY: meson
|
|
||||||
meson:
|
|
||||||
- [ -d build ] || meson setup build/
|
|
||||||
+ [ -d build ] || meson setup build/ --prefix=/usr
|
|
||||||
|
|
||||||
.PHONY: dist
|
|
||||||
dist: meson
|
|
||||||
diff --git a/config/init/meson.build b/config/init/meson.build
|
|
||||||
index 5200570..c781b59 100644
|
|
||||||
--- a/config/init/meson.build
|
|
||||||
+++ b/config/init/meson.build
|
|
||||||
@@ -14,6 +14,7 @@ if 'systemd' in init_script
|
|
||||||
'@OUTPUT@',
|
|
||||||
],
|
|
||||||
install: true,
|
|
||||||
+ install_mode: 'rw-r--r--',
|
|
||||||
install_dir: systemd_system_unit_dir)
|
|
||||||
endif
|
|
||||||
|
|
||||||
--
|
|
||||||
2.41.0
|
|
||||||
|
|
||||||
@ -1,18 +1,17 @@
|
|||||||
From 60eefa396251acebd02f06538ccee1081dcdcd0d Mon Sep 17 00:00:00 2001
|
From 7418289cfc1e14dc4aa71fd473a083a75fda75a7 Mon Sep 17 00:00:00 2001
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
Date: Thu, 27 Jul 2023 09:10:52 +0000
|
Date: Thu, 25 Nov 2021 20:21:46 +0800
|
||||||
Subject: [PATCH 12/15] lxcfs adapt 4.18 kernel
|
Subject: [PATCH 15/17] lxcfs-adapt-4.18-kernel
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
---
|
||||||
src/proc_fuse.c | 69 +++++++++++++++++++++----------------------------
|
src/proc_fuse.c | 69 +++++++++++++++++++++----------------------------
|
||||||
1 file changed, 30 insertions(+), 39 deletions(-)
|
1 file changed, 30 insertions(+), 39 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
||||||
index 0dbbefe..392115c 100644
|
index 0d5ba89..a72d6a2 100644
|
||||||
--- a/src/proc_fuse.c
|
--- a/src/proc_fuse.c
|
||||||
+++ b/src/proc_fuse.c
|
+++ b/src/proc_fuse.c
|
||||||
@@ -686,8 +686,8 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
@@ -659,8 +659,8 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
struct devinfo *container_devinfo = NULL, *ptr = NULL;
|
struct devinfo *container_devinfo = NULL, *ptr = NULL;
|
||||||
struct lxcfs_diskstats stats = {};
|
struct lxcfs_diskstats stats = {};
|
||||||
/* helper fields */
|
/* helper fields */
|
||||||
@ -23,7 +22,7 @@ index 0dbbefe..392115c 100644
|
|||||||
char *cache = d->buf;
|
char *cache = d->buf;
|
||||||
size_t cache_size = d->buflen;
|
size_t cache_size = d->buflen;
|
||||||
size_t linelen = 0, total_len = 0;
|
size_t linelen = 0, total_len = 0;
|
||||||
@@ -726,29 +726,15 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
@@ -699,29 +699,15 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
return read_file_fuse("/proc/diskstats", buf, size, d);
|
return read_file_fuse("/proc/diskstats", buf, size, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +55,7 @@ index 0dbbefe..392115c 100644
|
|||||||
|
|
||||||
f = fopen_cached("/proc/diskstats", "re", &fopen_cache);
|
f = fopen_cached("/proc/diskstats", "re", &fopen_cache);
|
||||||
if (!f)
|
if (!f)
|
||||||
@@ -784,9 +770,11 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
@@ -756,9 +742,11 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
get_blkio_io_value(io_serviced_str, stats.major, stats.minor, "Write", &stats.write);
|
get_blkio_io_value(io_serviced_str, stats.major, stats.minor, "Write", &stats.write);
|
||||||
get_blkio_io_value(io_serviced_str, stats.major, stats.minor, "Discard", &stats.discard);
|
get_blkio_io_value(io_serviced_str, stats.major, stats.minor, "Discard", &stats.discard);
|
||||||
|
|
||||||
@ -71,7 +70,7 @@ index 0dbbefe..392115c 100644
|
|||||||
|
|
||||||
get_blkio_io_value(io_service_bytes_str, stats.major, stats.minor, "Read", &stats.read_sectors);
|
get_blkio_io_value(io_service_bytes_str, stats.major, stats.minor, "Read", &stats.read_sectors);
|
||||||
stats.read_sectors = stats.read_sectors / 512;
|
stats.read_sectors = stats.read_sectors / 512;
|
||||||
@@ -795,26 +783,29 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
@@ -767,26 +755,29 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
get_blkio_io_value(io_service_bytes_str, stats.major, stats.minor, "Discard", &stats.discard_sectors);
|
get_blkio_io_value(io_service_bytes_str, stats.major, stats.minor, "Discard", &stats.discard_sectors);
|
||||||
stats.discard_sectors = stats.discard_sectors / 512;
|
stats.discard_sectors = stats.discard_sectors / 512;
|
||||||
|
|
||||||
@ -116,8 +115,8 @@ index 0dbbefe..392115c 100644
|
|||||||
- stats.total_ticks = stats.total_ticks / 1000000;
|
- stats.total_ticks = stats.total_ticks / 1000000;
|
||||||
+ stats.total_ticks = total_ticks / 1000000;
|
+ stats.total_ticks = total_ticks / 1000000;
|
||||||
|
|
||||||
memset(lbuf, 0, sizeof(lbuf));
|
memset(lbuf, 0, 256);
|
||||||
if (stats.read || stats.write || stats.read_merged || stats.write_merged ||
|
if (stats.read || stats.write || stats.read_merged || stats.write_merged ||
|
||||||
--
|
--
|
||||||
2.41.0
|
2.27.0
|
||||||
|
|
||||||
31
0016-remove-lxcfs-tools-dependency-for-common-use.patch
Normal file
31
0016-remove-lxcfs-tools-dependency-for-common-use.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
From 035571472fa6c5772cc6ac467cad7f8ffb9e1d8e Mon Sep 17 00:00:00 2001
|
||||||
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
|
Date: Thu, 25 Nov 2021 20:26:45 +0800
|
||||||
|
Subject: [PATCH 16/17] remove-lxcfs-tools-dependency-for-common-use
|
||||||
|
|
||||||
|
---
|
||||||
|
config/init/systemd/lxcfs.service.in | 6 +++---
|
||||||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config/init/systemd/lxcfs.service.in b/config/init/systemd/lxcfs.service.in
|
||||||
|
index 3d763c6..bdaa2fa 100644
|
||||||
|
--- a/config/init/systemd/lxcfs.service.in
|
||||||
|
+++ b/config/init/systemd/lxcfs.service.in
|
||||||
|
@@ -5,11 +5,11 @@ Before=lxc.service
|
||||||
|
Documentation=man:lxcfs(1)
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
-ExecStartPre=/usr/local/bin/lxcfs-tools prestart
|
||||||
|
+ExecStartPre=-/usr/local/bin/lxcfs-tools prestart
|
||||||
|
ExecStart=/usr/bin/lxcfs /var/lib/lxc/lxcfs/
|
||||||
|
-ExecStartPost=/usr/local/bin/lxcfs-tools remount -a
|
||||||
|
+ExecStartPost=-/usr/local/bin/lxcfs-tools remount -a
|
||||||
|
KillMode=process
|
||||||
|
-ExecStop=/usr/local/bin/lxcfs-tools umount -a
|
||||||
|
+ExecStop=-/usr/local/bin/lxcfs-tools umount -a
|
||||||
|
ExecStopPost=-/bin/fusermount -u /var/lib/lxc/
|
||||||
|
Delegate=yes
|
||||||
|
ExecReload=/bin/kill -USR1 $MAINPID
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
From c27c750ba028a65a3d136999e85939dbb9601b06 Mon Sep 17 00:00:00 2001
|
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
Date: Thu, 14 Dec 2023 07:27:07 +0000
|
|
||||||
Subject: [PATCH] typofix: fix incorrect printing in lxcfs help interface
|
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
|
||||||
src/lxcfs.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/lxcfs.c b/src/lxcfs.c
|
|
||||||
index cb0739c..c55a388 100644
|
|
||||||
--- a/src/lxcfs.c
|
|
||||||
+++ b/src/lxcfs.c
|
|
||||||
@@ -1181,7 +1181,7 @@ static void usage(void)
|
|
||||||
lxcfs_info("Options :");
|
|
||||||
lxcfs_info(" -d, --debug Run lxcfs with debugging enabled");
|
|
||||||
lxcfs_info(" -f, --foreground Run lxcfs in the foreground");
|
|
||||||
- lxcfs_info(" -n, --help Print help");
|
|
||||||
+ lxcfs_info(" -h, --help Print help");
|
|
||||||
lxcfs_info(" -l, --enable-loadavg Enable loadavg virtualization");
|
|
||||||
lxcfs_info(" -o Options to pass directly through fuse");
|
|
||||||
lxcfs_info(" -p, --pidfile=FILE Path to use for storing lxcfs pid");
|
|
||||||
--
|
|
||||||
2.41.0
|
|
||||||
|
|
||||||
29
0017-proc_fuse-fix-wait-child-process-hang.patch
Normal file
29
0017-proc_fuse-fix-wait-child-process-hang.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
From 798bb221b5862418bfb965dc93ce785c743919ff Mon Sep 17 00:00:00 2001
|
||||||
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
|
Date: Thu, 25 Nov 2021 20:30:09 +0800
|
||||||
|
Subject: [PATCH 17/17] proc_fuse-fix-wait-child-process-hang
|
||||||
|
|
||||||
|
---
|
||||||
|
src/proc_fuse.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
||||||
|
index a72d6a2..d02f841 100644
|
||||||
|
--- a/src/proc_fuse.c
|
||||||
|
+++ b/src/proc_fuse.c
|
||||||
|
@@ -561,11 +561,11 @@ struct devinfo* container_dev_read(pid_t pid) {
|
||||||
|
dev_num = dev_stat.st_dev & (~0xf);
|
||||||
|
fprintf(stream, "sda %d end 0 ", dev_num);
|
||||||
|
fflush(stream);
|
||||||
|
+child_out:
|
||||||
|
fclose(stream);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
-child_out:
|
||||||
|
close(mypipe[1]);
|
||||||
|
stream = fdopen(mypipe[0], "r");
|
||||||
|
if (stream == NULL) {
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
25
0018-fix-deadlock-problem-when-subprocess-exit.patch
Normal file
25
0018-fix-deadlock-problem-when-subprocess-exit.patch
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
From 4ad5ee6eafcdef8178adf1cea53ab8a617d3fd78 Mon Sep 17 00:00:00 2001
|
||||||
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
|
Date: Wed, 15 Dec 2021 17:19:01 +0800
|
||||||
|
Subject: [PATCH] fix deadlock problem when subprocess exit
|
||||||
|
|
||||||
|
---
|
||||||
|
src/proc_fuse.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
||||||
|
index d02f841..0f66c40 100644
|
||||||
|
--- a/src/proc_fuse.c
|
||||||
|
+++ b/src/proc_fuse.c
|
||||||
|
@@ -563,7 +563,7 @@ struct devinfo* container_dev_read(pid_t pid) {
|
||||||
|
fflush(stream);
|
||||||
|
child_out:
|
||||||
|
fclose(stream);
|
||||||
|
- exit(0);
|
||||||
|
+ _exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
close(mypipe[1]);
|
||||||
|
--
|
||||||
|
2.32.0 (Apple Git-132)
|
||||||
|
|
||||||
59
0019-fix-dev-read-memory-leak-in-container.patch
Normal file
59
0019-fix-dev-read-memory-leak-in-container.patch
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
From d67982ddf6d742b92799d1fb2e4c89e8ff87d95b Mon Sep 17 00:00:00 2001
|
||||||
|
From: zhangsong234 <zhangsong34@huawei.com>
|
||||||
|
Date: Wed, 11 May 2022 15:55:47 +0800
|
||||||
|
Subject: [PATCH] fix dev read memory leak in container
|
||||||
|
|
||||||
|
Signed-off-by: zhangsong234 <zhangsong34@huawei.com>
|
||||||
|
---
|
||||||
|
src/proc_fuse.c | 7 +++++--
|
||||||
|
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
|
||||||
|
index 0f66c40..6051e9a 100644
|
||||||
|
--- a/src/proc_fuse.c
|
||||||
|
+++ b/src/proc_fuse.c
|
||||||
|
@@ -497,7 +497,7 @@ struct devinfo* container_dev_read(pid_t pid) {
|
||||||
|
struct dirent *ptr;
|
||||||
|
struct stat dev_stat;
|
||||||
|
struct devinfo *head = NULL, *end;
|
||||||
|
- char fpath[100], dev_name[100];
|
||||||
|
+ char fpath[100], dev_name[101];
|
||||||
|
pid_t child_pid;
|
||||||
|
int mypipe[2];
|
||||||
|
int dev_num;
|
||||||
|
@@ -558,7 +558,7 @@ struct devinfo* container_dev_read(pid_t pid) {
|
||||||
|
}
|
||||||
|
closedir(dir);
|
||||||
|
stat("/", &dev_stat);
|
||||||
|
- dev_num = dev_stat.st_dev & (~0xf);
|
||||||
|
+ dev_num = dev_stat.st_dev;
|
||||||
|
fprintf(stream, "sda %d end 0 ", dev_num);
|
||||||
|
fflush(stream);
|
||||||
|
child_out:
|
||||||
|
@@ -574,6 +574,7 @@ child_out:
|
||||||
|
}
|
||||||
|
wait_for_pid(child_pid);
|
||||||
|
child_pid = 0;
|
||||||
|
+ memset(dev_name, 0, sizeof(dev_name));
|
||||||
|
while (fscanf(stream, "%100s%d", dev_name, &dev_num) == 2) {
|
||||||
|
if (dev_num == 0) {
|
||||||
|
break;
|
||||||
|
@@ -593,6 +594,7 @@ child_out:
|
||||||
|
end->name = must_copy_string(dev_name);
|
||||||
|
end->major = major(dev_num);
|
||||||
|
end->minor = minor(dev_num);
|
||||||
|
+ memset(dev_name, 0, sizeof(dev_name));
|
||||||
|
}
|
||||||
|
err:
|
||||||
|
if (stream)
|
||||||
|
@@ -883,6 +885,7 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
|
||||||
|
if (total_len > size)
|
||||||
|
total_len = size;
|
||||||
|
memcpy(buf, d->buf, total_len);
|
||||||
|
+ free_devinfo_list(container_devinfo);
|
||||||
|
|
||||||
|
return total_len;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
@ -1,20 +1,19 @@
|
|||||||
From 30f3e8cf0c6e34c5a8e4dd9d599c6c96646bd2ba Mon Sep 17 00:00:00 2001
|
From ed5823bf5b0d8bd425417d9b3590ece248fe1655 Mon Sep 17 00:00:00 2001
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
Date: Sat, 15 Jul 2023 03:43:12 +0000
|
Date: Sat, 26 Nov 2022 11:48:14 +0800
|
||||||
Subject: [PATCH 13/15] enable cfs option to show correct proc cpuinfo view
|
Subject: [PATCH] enable cfs option to show correct proc cpuinfo view
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
---
|
||||||
config/init/systemd/lxcfs.service.in | 2 +-
|
config/init/systemd/lxcfs.service.in | 2 +-
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/config/init/systemd/lxcfs.service.in b/config/init/systemd/lxcfs.service.in
|
diff --git a/config/init/systemd/lxcfs.service.in b/config/init/systemd/lxcfs.service.in
|
||||||
index bae1d08..c3bfd0f 100644
|
index bdaa2fa..3ee006b 100644
|
||||||
--- a/config/init/systemd/lxcfs.service.in
|
--- a/config/init/systemd/lxcfs.service.in
|
||||||
+++ b/config/init/systemd/lxcfs.service.in
|
+++ b/config/init/systemd/lxcfs.service.in
|
||||||
@@ -7,7 +7,7 @@ Documentation=man:lxcfs(1)
|
@@ -6,7 +6,7 @@ Documentation=man:lxcfs(1)
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
OOMScoreAdjust=-1000
|
|
||||||
ExecStartPre=-/usr/local/bin/lxcfs-tools prestart
|
ExecStartPre=-/usr/local/bin/lxcfs-tools prestart
|
||||||
-ExecStart=/usr/bin/lxcfs /var/lib/lxc/lxcfs/
|
-ExecStart=/usr/bin/lxcfs /var/lib/lxc/lxcfs/
|
||||||
+ExecStart=/usr/bin/lxcfs --enable-cfs /var/lib/lxc/lxcfs/
|
+ExecStart=/usr/bin/lxcfs --enable-cfs /var/lib/lxc/lxcfs/
|
||||||
@ -22,5 +21,5 @@ index bae1d08..c3bfd0f 100644
|
|||||||
KillMode=process
|
KillMode=process
|
||||||
ExecStop=-/usr/local/bin/lxcfs-tools umount -a
|
ExecStop=-/usr/local/bin/lxcfs-tools umount -a
|
||||||
--
|
--
|
||||||
2.41.0
|
2.30.0
|
||||||
|
|
||||||
@ -1,15 +1,15 @@
|
|||||||
From 2c07195cd633c270ddcc6ef5349dbbc7063302d5 Mon Sep 17 00:00:00 2001
|
From e3ca16cd280bea10a63e959623fd6625f7b868ce Mon Sep 17 00:00:00 2001
|
||||||
From: vegbir <yangjiaqi16@huawei.com>
|
From: yangjiaqi <yangjiaqi16@huawei.com>
|
||||||
Date: Sat, 15 Jul 2023 04:25:53 +0000
|
Date: Thu, 24 Nov 2022 15:53:53 +0800
|
||||||
Subject: [PATCH 14/15] fix pidfd_open pidfd_send_signal function compilation
|
Subject: [PATCH] fix pidfd_open&pidfd_send_signal function compilation bug in
|
||||||
|
glibc2.36+
|
||||||
|
|
||||||
Signed-off-by: vegbir <yangjiaqi16@huawei.com>
|
|
||||||
---
|
---
|
||||||
src/utils.h | 6 ++++++
|
src/utils.h | 6 ++++++
|
||||||
1 file changed, 6 insertions(+)
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
diff --git a/src/utils.h b/src/utils.h
|
diff --git a/src/utils.h b/src/utils.h
|
||||||
index 7ed021a..5f19946 100644
|
index 18d85a7..ab2da0f 100644
|
||||||
--- a/src/utils.h
|
--- a/src/utils.h
|
||||||
+++ b/src/utils.h
|
+++ b/src/utils.h
|
||||||
@@ -46,6 +46,9 @@ static inline int pidfd_open(pid_t pid, unsigned int flags)
|
@@ -46,6 +46,9 @@ static inline int pidfd_open(pid_t pid, unsigned int flags)
|
||||||
@ -33,5 +33,5 @@ index 7ed021a..5f19946 100644
|
|||||||
|
|
||||||
extern FILE *fopen_cached(const char *path, const char *mode,
|
extern FILE *fopen_cached(const char *path, const char *mode,
|
||||||
--
|
--
|
||||||
2.41.0
|
2.30.0
|
||||||
|
|
||||||
BIN
lxcfs-4.0.11.tar.gz
Normal file
BIN
lxcfs-4.0.11.tar.gz
Normal file
Binary file not shown.
Binary file not shown.
78
lxcfs.spec
78
lxcfs.spec
@ -3,32 +3,37 @@
|
|||||||
|
|
||||||
#Basic Information
|
#Basic Information
|
||||||
Name: lxcfs
|
Name: lxcfs
|
||||||
Version: 5.0.4
|
Version: 4.0.11
|
||||||
Release: 2
|
Release: 6
|
||||||
Summary: FUSE filesystem for LXC
|
Summary: FUSE filesystem for LXC
|
||||||
License: LGPL 2.1+
|
License: LGPL 2.1+
|
||||||
URL: http://linuxcontainers.org
|
URL: http://linuxcontainers.org
|
||||||
Source: https://linuxcontainers.org/downloads/%{name}/%{name}-%{version}.tar.gz
|
Source: https://linuxcontainers.org/downloads/%{name}/%{name}-%{version}.tar.gz
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
Patch9001: 0001-systemd.patch
|
Patch9001: 0001-systemd.patch
|
||||||
Patch9002: 0002-show-dev-name-in-container.patch
|
Patch9002: 0002-remove-sysvinit-upstart.patch
|
||||||
Patch9003: 0003-lxcfs-fix-cpuinfo-print.patch
|
Patch9003: 0003-show-dev-name-in-container.patch
|
||||||
Patch9004: 0004-fix-memory-leak.patch
|
Patch9004: 0004-lxcfs-fix-cpuinfo-print.patch
|
||||||
Patch9005: 0005-fix-concurrency-problem.patch
|
Patch9005: 0005-fix-memory-leak.patch
|
||||||
Patch9006: 0006-set-null-after-free.patch
|
Patch9006: 0006-fix-concurrency-problem.patch
|
||||||
Patch9007: 0007-limit-stat-by-quota-period-setting.patch
|
Patch9007: 0007-set-null-after-free.patch
|
||||||
Patch9008: 0008-diskstats-support-devicemapper-device.patch
|
Patch9008: 0008-fix-hang.patch
|
||||||
Patch9009: 0009-lxcfs-add-proc-partitions.patch
|
Patch9009: 0009-limit-stat-by-quota-period-setting.patch
|
||||||
Patch9010: 0010-lxcfs-proc_diskstats_read-func-obtain-data-from-blki.patch
|
Patch9010: 0010-diskstats-support-devicemapper-device.patch
|
||||||
Patch9011: 0011-add-secure-compile-option-in-meson.patch
|
Patch9011: 0011-lxcfs-add-proc-partitions.patch
|
||||||
Patch9012: 0012-lxcfs-adapt-4.18-kernel.patch
|
Patch9012: 0012-lxcfs-proc_diskstats_read-func-obtain-data-from-blki.patch
|
||||||
Patch9013: 0013-enable-cfs-option-to-show-correct-proc-cpuinfo-view.patch
|
Patch9013: 0013-add-secure-compile-option-in-Makefile.patch
|
||||||
Patch9014: 0014-fix-pidfd_open-pidfd_send_signal-function-compilatio.patch
|
Patch9014: 0014-fix-proc-diskstats-show-in-container.patch
|
||||||
Patch9015: 0015-adapt-meson-build-install.patch
|
Patch9015: 0015-lxcfs-adapt-4.18-kernel.patch
|
||||||
Patch9016: 0016-typofix-fix-incorrect-printing-in-lxcfs-help-interfa.patch
|
Patch9016: 0016-remove-lxcfs-tools-dependency-for-common-use.patch
|
||||||
|
Patch9017: 0017-proc_fuse-fix-wait-child-process-hang.patch
|
||||||
|
Patch9018: 0018-fix-deadlock-problem-when-subprocess-exit.patch
|
||||||
|
Patch9019: 0019-fix-dev-read-memory-leak-in-container.patch
|
||||||
|
Patch9020: 0020-enable-cfs-option-to-show-correct-proc-cpuinfo-view.patch
|
||||||
|
Patch9021: 0021-fix-pidfd_open-pidfd_send_signal-function-compilatio.patch
|
||||||
|
|
||||||
#Dependency
|
#Dependency
|
||||||
BuildRequires: meson python3-jinja2 help2man
|
BuildRequires: autoconf automake libtool help2man
|
||||||
BuildRequires: fuse-devel libattr-devel
|
BuildRequires: fuse-devel libattr-devel
|
||||||
BuildRequires: gcc systemd-units
|
BuildRequires: gcc systemd-units
|
||||||
Requires: fuse-libs
|
Requires: fuse-libs
|
||||||
@ -42,11 +47,15 @@ any runtime, written in C using libfuse and glib.
|
|||||||
%autosetup -p1
|
%autosetup -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
autoreconf --force --install
|
||||||
|
%configure
|
||||||
|
make tests
|
||||||
make %{?_smp_mflags}
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
install -d -m 0755 %{buildroot}%{_unitdir}
|
|
||||||
make install DESTDIR=%{buildroot} %{?_smp_mflags}
|
make install DESTDIR=%{buildroot} %{?_smp_mflags}
|
||||||
|
install -d -m 0755 %{buildroot}%{_unitdir}
|
||||||
|
install -p -m 0644 config/init/systemd/*.service %{buildroot}%{_unitdir}/
|
||||||
install -d -m 0755 %{buildroot}%{_sbindir}
|
install -d -m 0755 %{buildroot}%{_sbindir}
|
||||||
ln -sf service %{buildroot}%{_sbindir}/rc%{name}
|
ln -sf service %{buildroot}%{_sbindir}/rc%{name}
|
||||||
install -d -m 0755 %{buildroot}%{_includedir}/%{name}
|
install -d -m 0755 %{buildroot}%{_includedir}/%{name}
|
||||||
@ -78,40 +87,11 @@ fi
|
|||||||
%dir %{_localstatedir}/lib/lxc/%{name}
|
%dir %{_localstatedir}/lib/lxc/%{name}
|
||||||
%dir %{_libdir}/%{name}
|
%dir %{_libdir}/%{name}
|
||||||
%{_libdir}/%{name}/lib%{name}.so
|
%{_libdir}/%{name}/lib%{name}.so
|
||||||
|
%exclude %{_libdir}/%{name}/lib%{name}.la
|
||||||
%{_mandir}/man1/*
|
%{_mandir}/man1/*
|
||||||
%{_unitdir}/*
|
%{_unitdir}/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Fri Dec 15 2023 yangjiaqi <yangjiaqi16@huawei.com> - 5.0.4-2
|
|
||||||
- Type:bugfix
|
|
||||||
- CVE:NA
|
|
||||||
- SUG:NA
|
|
||||||
- DESC:fix incorrect printing in lxcfs help interface
|
|
||||||
|
|
||||||
* Thu July 27 2023 yangjiaqi <yangjiaqi16@huawei.com> - 5.0.4-1
|
|
||||||
- Type:bugfix
|
|
||||||
- CVE:NA
|
|
||||||
- SUG:NA
|
|
||||||
- DESC:upgrade to 5.0.4
|
|
||||||
|
|
||||||
* Mon July 17 2023 yangjiaqi <yangjiaqi16@huawei.com> - 5.0.3-1
|
|
||||||
- Type:bugfix
|
|
||||||
- CVE:NA
|
|
||||||
- SUG:NA
|
|
||||||
- DESC:upgrade to 5.0.3
|
|
||||||
|
|
||||||
* Wed Mar 22 2023 yangjiaqi <yangjiaqi16@huawei.com> - 4.0.11-8
|
|
||||||
- Type:bugfix
|
|
||||||
- CVE:NA
|
|
||||||
- SUG:NA
|
|
||||||
- DESC:fix /proc/diskstats output format
|
|
||||||
|
|
||||||
* Wed Mar 22 2023 yangjiaqi <yangjiaqi16@huawei.com> - 4.0.11-7
|
|
||||||
- Type:bugfix
|
|
||||||
- CVE:NA
|
|
||||||
- SUG:NA
|
|
||||||
- DESC:fix possible use-after-free in find_proc_stat_node
|
|
||||||
|
|
||||||
* Mon Dec 12 2022 yangjiaqi <yangjiaqi16@huawei.com> - 4.0.11-6
|
* Mon Dec 12 2022 yangjiaqi <yangjiaqi16@huawei.com> - 4.0.11-6
|
||||||
- add yaml
|
- add yaml
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user