!50 [sync] PR-49: enable cfs option to show correct proc cpuinfo view

### 1. Origin pull request:
https://gitee.com/src-openeuler/lxcfs/pulls/49

### 2. Original pull request related issue(s):

### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[f8592c6f](f8592c6f76)|2022-07-04 17:23:16 +0800 CST|enable cfs option to show correct proc cpuinfo view<br>|
 
From: @openeuler-sync-bot 
Reviewed-by: @zhangsong234, @duguhaotian 
Signed-off-by: @duguhaotian
This commit is contained in:
openeuler-ci-bot 2022-07-05 01:44:43 +00:00 committed by Gitee
commit 05a59941fa
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 35 additions and 6 deletions

View File

@ -87,9 +87,9 @@ index bcd624d..0aaab71 100644
{ {
struct file_info *f = INTTYPE_TO_PTR(fi->fh); struct file_info *f = INTTYPE_TO_PTR(fi->fh);
+ if (!f->buf) + if (!f->buf)
+ return -EINVAL; + return -EINVAL;
+ +
switch (f->type) { switch (f->type) {
case LXC_TYPE_PROC_MEMINFO: case LXC_TYPE_PROC_MEMINFO:
if (liblxcfs_functional()) if (liblxcfs_functional())

View File

@ -145,7 +145,7 @@ index 5c22fd1..b396bbc 100644
+ for (i = 0; clist[i]; i++) { + for (i = 0; clist[i]; i++) {
free(clist[i]); free(clist[i]);
+ clist[i] = NULL; + clist[i] = NULL;
+ } + }
free(clist); free(clist);
} }
return ret; return ret;
@ -251,7 +251,7 @@ index c689c8e..a7e4a58 100644
+ for (int i = 0; list[i]; i++) { + for (int i = 0; list[i]; i++) {
free(list[i]); free(list[i]);
+ list[i] = NULL; + list[i] = NULL;
+ } + }
free_disarm(list); free_disarm(list);
} }
} }
@ -267,7 +267,7 @@ index 5f9bec7..c8daf35 100644
+ for (; i > 0; i--) { + for (; i > 0; i--) {
free(idbuf[i - 1]); free(idbuf[i - 1]);
+ idbuf[i - 1] = NULL; + idbuf[i - 1] = NULL;
+ } + }
out: out:
free(idbuf); free(idbuf);
+ idbuf = NULL; + idbuf = NULL;

View File

@ -0,0 +1,25 @@
From ba38ee0ef8e375ae7e1b19d6e99626b1152ddef8 Mon Sep 17 00:00:00 2001
From: vegbir <yangjiaqi16@huawei.com>
Date: Mon, 4 Jul 2022 17:15:19 +0800
Subject: [PATCH] enable cfs option to show correct proc cpuinfo view
---
config/init/systemd/lxcfs.service | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/init/systemd/lxcfs.service b/config/init/systemd/lxcfs.service
index dbb029f..f24e11b 100644
--- a/config/init/systemd/lxcfs.service
+++ b/config/init/systemd/lxcfs.service
@@ -5,7 +5,7 @@ Before=lxc.service
Documentation=man:lxcfs(1)
[Service]
-ExecStart=/usr/bin/lxcfs /usr/local/var/lib/lxcfs
+ExecStart=/usr/bin/lxcfs --enable-cfs /usr/local/var/lib/lxcfs
KillMode=process
Restart=on-failure
ExecStopPost=-/bin/fusermount -u /usr/local/var/lib/lxcfs
--
2.32.1 (Apple Git-133)

View File

@ -4,7 +4,7 @@
#Basic Information #Basic Information
Name: lxcfs Name: lxcfs
Version: 4.0.11 Version: 4.0.11
Release: 3 Release: 4
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
@ -29,6 +29,7 @@ Patch9016: 0016-remove-lxcfs-tools-dependency-for-common-use.patch
Patch9017: 0017-proc_fuse-fix-wait-child-process-hang.patch Patch9017: 0017-proc_fuse-fix-wait-child-process-hang.patch
Patch9018: 0018-fix-deadlock-problem-when-subprocess-exit.patch Patch9018: 0018-fix-deadlock-problem-when-subprocess-exit.patch
Patch9019: 0019-fix-dev-read-memory-leak-in-container.patch Patch9019: 0019-fix-dev-read-memory-leak-in-container.patch
Patch9020: 0020-enable-cfs-option-to-show-correct-proc-cpuinfo-view.patch
#Dependency #Dependency
BuildRequires: autoconf automake libtool help2man BuildRequires: autoconf automake libtool help2man
@ -90,6 +91,9 @@ fi
%{_unitdir}/* %{_unitdir}/*
%changelog %changelog
* Mon Jul 04 2022 yangjiaqi <yangjiaqi16@huawei.com> - 4.0.11-4
- enable cfs option to show correct proc cpuinfo view
* Wed May 11 2022 zhangsong234 <zhangsong34@huawei.com> - 4.0.11-3 * Wed May 11 2022 zhangsong234 <zhangsong34@huawei.com> - 4.0.11-3
- fix dev read memory leak in container - fix dev read memory leak in container