mirror of
https://github.com/collectd/collectd.git
synced 2026-02-09 04:09:15 +08:00
Hugepages plugin skips reading write-only file
Since 'demote' is a write-only file do not attempt to to read it. This also prevents the plugin from generating incessant logs about the failure to open it. Fixes: #3993 https://docs.kernel.org/admin-guide/mm/hugetlbpage.html
This commit is contained in:
committed by
Matthias Runge
parent
71d2846b50
commit
876ce9f82e
@@ -125,6 +125,14 @@ static int read_hugepage_entry(const char *path, const char *entry,
|
||||
struct entry_info *info = e_info;
|
||||
double value;
|
||||
|
||||
/**
|
||||
* Since demote is a write-only file, do not attempt to open it.
|
||||
* https://docs.kernel.org/admin-guide/mm/hugetlbpage.html
|
||||
*/
|
||||
if (strcmp(entry, "demote") == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
snprintf(path2, sizeof(path2), "%s/%s", path, entry);
|
||||
|
||||
FILE *fh = fopen(path2, "rt");
|
||||
|
||||
Reference in New Issue
Block a user