summaryrefslogtreecommitdiffstats
path: root/collectors/ebpf.plugin
diff options
context:
space:
mode:
authorthiagoftsm <thiagoftsm@gmail.com>2022-06-30 06:38:57 +0000
committerGitHub <noreply@github.com>2022-06-30 06:38:57 +0000
commit3f9d90a155f6b7526d430852012835aeab5d1770 (patch)
treee64a7728b0e2e81928ecaebcc2762346bfe8bf0c /collectors/ebpf.plugin
parentb8c08a6fd1170fc529def3127a744a5294ba5c8d (diff)
Ebpf issues (#13259)
Diffstat (limited to 'collectors/ebpf.plugin')
-rw-r--r--collectors/ebpf.plugin/ebpf.c43
-rw-r--r--collectors/ebpf.plugin/ebpf_apps.h2
-rw-r--r--collectors/ebpf.plugin/ebpf_cachestat.c17
-rw-r--r--collectors/ebpf.plugin/ebpf_cachestat.h1
-rw-r--r--collectors/ebpf.plugin/ebpf_cgroup.c20
-rw-r--r--collectors/ebpf.plugin/ebpf_cgroup.h1
-rw-r--r--collectors/ebpf.plugin/ebpf_dcstat.c17
-rw-r--r--collectors/ebpf.plugin/ebpf_dcstat.h1
-rw-r--r--collectors/ebpf.plugin/ebpf_disk.c3
-rw-r--r--collectors/ebpf.plugin/ebpf_fd.c17
-rw-r--r--collectors/ebpf.plugin/ebpf_fd.h1
-rw-r--r--collectors/ebpf.plugin/ebpf_filesystem.c3
-rw-r--r--collectors/ebpf.plugin/ebpf_hardirq.c3
-rw-r--r--collectors/ebpf.plugin/ebpf_mdflush.c3
-rw-r--r--collectors/ebpf.plugin/ebpf_mount.c3
-rw-r--r--collectors/ebpf.plugin/ebpf_oomkill.c3
-rw-r--r--collectors/ebpf.plugin/ebpf_process.c21
-rw-r--r--collectors/ebpf.plugin/ebpf_shm.c15
-rw-r--r--collectors/ebpf.plugin/ebpf_shm.h1
-rw-r--r--collectors/ebpf.plugin/ebpf_socket.c12
-rw-r--r--collectors/ebpf.plugin/ebpf_socket.h1
-rw-r--r--collectors/ebpf.plugin/ebpf_softirq.c3
-rw-r--r--collectors/ebpf.plugin/ebpf_swap.c15
-rw-r--r--collectors/ebpf.plugin/ebpf_swap.h1
-rw-r--r--collectors/ebpf.plugin/ebpf_sync.c3
-rw-r--r--collectors/ebpf.plugin/ebpf_vfs.c17
-rw-r--r--collectors/ebpf.plugin/ebpf_vfs.h1
27 files changed, 32 insertions, 196 deletions
diff --git a/collectors/ebpf.plugin/ebpf.c b/collectors/ebpf.plugin/ebpf.c
index 2b25f50a31..5c3c716065 100644
--- a/collectors/ebpf.plugin/ebpf.c
+++ b/collectors/ebpf.plugin/ebpf.c
@@ -219,51 +219,8 @@ static void ebpf_exit(int sig)
return;
}
- if (ebpf_modules[EBPF_MODULE_SOCKET_IDX].enabled) {
- ebpf_modules[EBPF_MODULE_SOCKET_IDX].enabled = 0;
- clean_socket_apps_structures();
- freez(socket_bandwidth_curr);
- }
-
- if (ebpf_modules[EBPF_MODULE_CACHESTAT_IDX].enabled) {
- ebpf_modules[EBPF_MODULE_CACHESTAT_IDX].enabled = 0;
- clean_cachestat_pid_structures();
- freez(cachestat_pid);
- }
-
- if (ebpf_modules[EBPF_MODULE_DCSTAT_IDX].enabled) {
- ebpf_modules[EBPF_MODULE_DCSTAT_IDX].enabled = 0;
- clean_dcstat_pid_structures();
- freez(dcstat_pid);
- }
-
- if (ebpf_modules[EBPF_MODULE_SWAP_IDX].enabled) {
- ebpf_modules[EBPF_MODULE_SWAP_IDX].enabled = 0;
- clean_swap_pid_structures();
- freez(swap_pid);
- }
-
- if (ebpf_modules[EBPF_MODULE_VFS_IDX].enabled) {
- ebpf_modules[EBPF_MODULE_VFS_IDX].enabled = 0;
- clean_vfs_pid_structures();
- freez(vfs_pid);
- }
-
- if (ebpf_modules[EBPF_MODULE_FD_IDX].enabled) {
- ebpf_modules[EBPF_MODULE_FD_IDX].enabled = 0;
- clean_fd_pid_structures();
- freez(fd_pid);
- }
-
- if (ebpf_modules[EBPF_MODULE_SHM_IDX].enabled) {
- ebpf_modules[EBPF_MODULE_SHM_IDX].enabled = 0;
- clean_shm_pid_structures();
- freez(shm_pid);
- }
-
ebpf_close_cgroup_shm();
- ebpf_clean_cgroup_pids();
/*
int ret = fork();
if (ret < 0) // error
diff --git a/collectors/ebpf.plugin/ebpf_apps.h b/collectors/ebpf.plugin/ebpf_apps.h
index 259e642ad3..f65a137b54 100644
--- a/collectors/ebpf.plugin/ebpf_apps.h
+++ b/collectors/ebpf.plugin/ebpf_apps.h
@@ -433,8 +433,6 @@ extern size_t read_bandwidth_statistic_using_pid_on_target(ebpf_bandwidth_t **ep
extern void collect_data_for_all_processes(int tbl_pid_stats_fd);
-extern void clean_global_memory();
-
extern ebpf_process_stat_t **global_process_stats;
extern ebpf_process_publish_apps_t **current_apps_data;
extern netdata_publish_cachestat_t **cachestat_pid;
diff --git a/collectors/ebpf.plugin/ebpf_cachestat.c b/collectors/ebpf.plugin/ebpf_cachestat.c
index dbf2f68f0a..fa3f932e17 100644
--- a/collectors/ebpf.plugin/ebpf_cachestat.c
+++ b/collectors/ebpf.plugin/ebpf_cachestat.c
@@ -294,20 +294,6 @@ static inline int ebpf_cachestat_load_and_attach(struct cachestat_bpf *obj, ebpf
*****************************************************************/
/**
- * Clean PID structures
- *
- * Clean the allocated structures.
- */
-void clean_cachestat_pid_structures() {
- struct pid_stat *pids = root_of_pids;
- while (pids) {
- freez(cachestat_pid[pids->pid]);
-
- pids = pids->next;
- }
-}
-
-/**
* Clean up the main thread.
*
* @param ptr thread data.
@@ -338,7 +324,8 @@ static void ebpf_cachestat_cleanup(void *ptr)
bpf_link__destroy(probe_links[i]);
i++;
}
- bpf_object__close(objects);
+ if (objects)
+ bpf_object__close(objects);
}
#ifdef LIBBPF_MAJOR_VERSION
else if (bpf_obj)
diff --git a/collectors/ebpf.plugin/ebpf_cachestat.h b/collectors/ebpf.plugin/ebpf_cachestat.h
index b386e383c8..fdd88464ad 100644
--- a/collectors/ebpf.plugin/ebpf_cachestat.h
+++ b/collectors/ebpf.plugin/ebpf_cachestat.h
@@ -82,7 +82,6 @@ typedef struct netdata_publish_cachestat {
} netdata_publish_cachestat_t;
extern void *ebpf_cachestat_thread(void *ptr);
-extern void clean_cachestat_pid_structures();
extern struct config cachestat_config;
extern netdata_ebpf_targets_t cachestat_targets[];
diff --git a/collectors/ebpf.plugin/ebpf_cgroup.c b/collectors/ebpf.plugin/ebpf_cgroup.c
index e6b483bafa..24469c6420 100644
--- a/collectors/ebpf.plugin/ebpf_cgroup.c
+++ b/collectors/ebpf.plugin/ebpf_cgroup.c
@@ -134,26 +134,6 @@ static inline void ebpf_clean_specific_cgroup_pids(struct pid_on_target2 *pt)
}
/**
- * Cleanup link list
- */
-void ebpf_clean_cgroup_pids()
-{
- if (!ebpf_cgroup_pids)
- return;
-
- ebpf_cgroup_target_t *ect = ebpf_cgroup_pids;
- while (ect) {
- ebpf_cgroup_target_t *next_cgroup = ect->next;
-
- ebpf_clean_specific_cgroup_pids(ect->pids);
- freez(ect);
-
- ect = next_cgroup;
- }
- ebpf_cgroup_pids = NULL;
-}
-
-/**
* Remove Cgroup Update Target Update List
*
* Remove from cgroup target and update the link list
diff --git a/collectors/ebpf.plugin/ebpf_cgroup.h b/collectors/ebpf.plugin/ebpf_cgroup.h
index 03969194a6..cca9a950d1 100644
--- a/collectors/ebpf.plugin/ebpf_cgroup.h
+++ b/collectors/ebpf.plugin/ebpf_cgroup.h
@@ -63,7 +63,6 @@ typedef struct ebpf_cgroup_target {
extern void ebpf_map_cgroup_shared_memory();
extern void ebpf_parse_cgroup_shm_data();
extern void ebpf_close_cgroup_shm();
-extern void ebpf_clean_cgroup_pids();
extern void ebpf_create_charts_on_systemd(char *id, char *title, char *units, char *family, char *charttype, int order,
char *algorithm, char *context, char *module, int update_every);
diff --git a/collectors/ebpf.plugin/ebpf_dcstat.c b/collectors/ebpf.plugin/ebpf_dcstat.c
index 732a4102e5..4344b98875 100644
--- a/collectors/ebpf.plugin/ebpf_dcstat.c
+++ b/collectors/ebpf.plugin/ebpf_dcstat.c
@@ -252,20 +252,6 @@ void dcstat_update_publish(netdata_publish_dcstat_t *out, uint64_t cache_access,
*****************************************************************/
/**
- * Clean PID structures
- *
- * Clean the allocated structures.
- */
-void clean_dcstat_pid_structures() {
- struct pid_stat *pids = root_of_pids;
- while (pids) {
- freez(dcstat_pid[pids->pid]);
-
- pids = pids->next;
- }
-}
-
-/**
* Clean names
*
* Clean the optional names allocated during startup.
@@ -312,7 +298,8 @@ static void ebpf_dcstat_cleanup(void *ptr)
bpf_link__destroy(probe_links[i]);
i++;
}
- bpf_object__close(objects);
+ if (objects)
+ bpf_object__close(objects);
}
#ifdef LIBBPF_MAJOR_VERSION
else if (bpf_obj)
diff --git a/collectors/ebpf.plugin/ebpf_dcstat.h b/collectors/ebpf.plugin/ebpf_dcstat.h
index 9408647377..5c4a80cd7d 100644
--- a/collectors/ebpf.plugin/ebpf_dcstat.h
+++ b/collectors/ebpf.plugin/ebpf_dcstat.h
@@ -77,7 +77,6 @@ typedef struct netdata_publish_dcstat {
extern void *ebpf_dcstat_thread(void *ptr);
extern void ebpf_dcstat_create_apps_charts(struct ebpf_module *em, void *ptr);
-extern void clean_dcstat_pid_structures();
extern struct config dcstat_config;
extern netdata_ebpf_targets_t dc_targets[];
diff --git a/collectors/ebpf.plugin/ebpf_disk.c b/collectors/ebpf.plugin/ebpf_disk.c
index 3ddf50b935..f76dfd0fba 100644
--- a/collectors/ebpf.plugin/ebpf_disk.c
+++ b/collectors/ebpf.plugin/ebpf_disk.c
@@ -465,7 +465,8 @@ static void ebpf_disk_cleanup(void *ptr)
bpf_link__destroy(probe_links[i]);
i++;
}
- bpf_object__close(objects);
+ if (objects)
+ bpf_object__close(objects);
}
}
diff --git a/collectors/ebpf.plugin/ebpf_fd.c b/collectors/ebpf.plugin/ebpf_fd.c
index 10a50c4ebe..7eaa5c273f 100644
--- a/collectors/ebpf.plugin/ebpf_fd.c
+++ b/collectors/ebpf.plugin/ebpf_fd.c
@@ -48,20 +48,6 @@ netdata_fd_stat_t **fd_pid = NULL;
*****************************************************************/
/**
- * Clean PID structures
- *
- * Clean the allocated structures.
- */
-void clean_fd_pid_structures() {
- struct pid_stat *pids = root_of_pids;
- while (pids) {
- freez(fd_pid[pids->pid]);
-
- pids = pids->next;
- }
-}
-
-/**
* Clean up the main thread.
*
* @param ptr thread data.
@@ -92,7 +78,8 @@ static void ebpf_fd_cleanup(void *ptr)
bpf_link__destroy(probe_links[i]);
i++;
}
- bpf_object__close(objects);
+ if (objects)
+ bpf_object__close(objects);
}
}
diff --git a/collectors/ebpf.plugin/ebpf_fd.h b/collectors/ebpf.plugin/ebpf_fd.h
index 851e040e58..8742558dfe 100644
--- a/collectors/ebpf.plugin/ebpf_fd.h
+++ b/collectors/ebpf.plugin/ebpf_fd.h
@@ -79,7 +79,6 @@ extern void *ebpf_fd_thread(void *ptr);
extern void ebpf_fd_create_apps_charts(struct ebpf_module *em, void *ptr);
extern struct config fd_config;
extern netdata_fd_stat_t **fd_pid;
-extern void clean_fd_pid_structures();
#endif /* NETDATA_EBPF_FD_H */
diff --git a/collectors/ebpf.plugin/ebpf_filesystem.c b/collectors/ebpf.plugin/ebpf_filesystem.c
index 415a42dbcb..5925e85b50 100644
--- a/collectors/ebpf.plugin/ebpf_filesystem.c
+++ b/collectors/ebpf.plugin/ebpf_filesystem.c
@@ -381,7 +381,8 @@ void ebpf_filesystem_cleanup_ebpf_data()
bpf_link__destroy(probe_links[j]);
j++;
}
- bpf_object__close(efp->objects);
+ if (efp->objects)
+ bpf_object__close(efp->objects);
}
}
}
diff --git a/collectors/ebpf.plugin/ebpf_hardirq.c b/collectors/ebpf.plugin/ebpf_hardirq.c
index 25b2a0ec65..21383f2aa1 100644
--- a/collectors/ebpf.plugin/ebpf_hardirq.c
+++ b/collectors/ebpf.plugin/ebpf_hardirq.c
@@ -179,7 +179,8 @@ static void hardirq_cleanup(void *ptr)
bpf_link__destroy(probe_links[i]);
i++;
}
- bpf_object__close(objects);
+ if (objects)
+ bpf_object__close(objects);
}
}
diff --git a/collectors/ebpf.plugin/ebpf_mdflush.c b/collectors/ebpf.plugin/ebpf_mdflush.c
index 9f75543d77..e280fbb97a 100644
--- a/collectors/ebpf.plugin/ebpf_mdflush.c
+++ b/collectors/ebpf.plugin/ebpf_mdflush.c
@@ -74,7 +74,8 @@ static void mdflush_cleanup(void *ptr)
bpf_link__destroy(probe_links[i]);
i++;
}
- bpf_object__close(objects);
+ if (objects)
+ bpf_object__close(objects);
}
}
diff --git a/collectors/ebpf.plugin/ebpf_mount.c b/collectors/ebpf.plugin/ebpf_mount.c
index 1ba1e135c3..29e5a11d6c 100644
--- a/collectors/ebpf.plugin/ebpf_mount.c
+++ b/collectors/ebpf.plugin/ebpf_mount.c
@@ -247,7 +247,8 @@ static void ebpf_mount_cleanup(void *ptr)
bpf_link__destroy(probe_links[i]);
i++;
}
- bpf_object__close(objects);
+ if (objects)
+ bpf_object__close(objects);
}
#ifdef LIBBPF_MAJOR_VERSION
else if (bpf_obj)
diff --git a/collectors/ebpf.plugin/ebpf_oomkill.c b/collectors/ebpf.plugin/ebpf_oomkill.c
index 463a329049..373e2c2ba4 100644
--- a/collectors/ebpf.plugin/ebpf_oomkill.c
+++ b/collectors/ebpf.plugin/ebpf_oomkill.c
@@ -60,7 +60,8 @@ static void oomkill_cleanup(void *ptr)
bpf_link__destroy(probe_links[i]);
i++;
}
- bpf_object__close(objects);
+ if (objects)
+ bpf_object__close(objects);
}
}
diff --git a/collectors/ebpf.plugin/ebpf_process.c b/collectors/ebpf.plugin/ebpf_process.c
index f894f07076..784999bab0 100644
--- a/collectors/ebpf.plugin/ebpf_process.c
+++ b/collectors/ebpf.plugin/ebpf_process.c
@@ -1093,20 +1093,6 @@ static void process_collector(ebpf_module_t *em)
*
*****************************************************************/
-void clean_global_memory() {
- int pid_fd = process_maps[NETDATA_PROCESS_PID_TABLE].map_fd;
- struct pid_stat *pids = root_of_pids;
- while (pids) {
- uint32_t pid = pids->pid;
- freez(global_process_stats[pid]);
-
- bpf_map_delete_elem(pid_fd, &pid);
- freez(current_apps_data[pid]);
-
- pids = pids->next;
- }
-}
-
/**
* Process disable tracepoints
*
@@ -1151,10 +1137,6 @@ static void ebpf_process_cleanup(void *ptr)
ebpf_cleanup_publish_syscall(process_publish_aggregated);
freez(process_hash_values);
- clean_global_memory();
- freez(global_process_stats);
- freez(current_apps_data);
-
ebpf_process_disable_tracepoints();
if (probe_links) {
@@ -1164,7 +1146,8 @@ static void ebpf_process_cleanup(void *ptr)
bpf_link__destroy(probe_links[i]);
i++;
}
- bpf_object__close(objects);
+ if (objects)
+ bpf_object__close(objects);
}
freez(cgroup_thread.thread);
diff --git a/collectors/ebpf.plugin/ebpf_shm.c b/collectors/ebpf.plugin/ebpf_shm.c
index 939741e757..d5b21469ed 100644
--- a/collectors/ebpf.plugin/ebpf_shm.c
+++ b/collectors/ebpf.plugin/ebpf_shm.c
@@ -243,18 +243,6 @@ static inline int ebpf_shm_load_and_attach(struct shm_bpf *obj, ebpf_module_t *e
*****************************************************************/
/**
- * Clean shm structure
- */
-void clean_shm_pid_structures() {
- struct pid_stat *pids = root_of_pids;
- while (pids) {
- freez(shm_pid[pids->pid]);
-
- pids = pids->next;
- }
-}
-
-/**
* Clean up the main thread.
*
* @param ptr thread data.
@@ -286,7 +274,8 @@ static void ebpf_shm_cleanup(void *ptr)
bpf_link__destroy(probe_links[i]);
i++;
}
- bpf_object__close(objects);
+ if (objects)
+ bpf_object__close(objects);
}
#ifdef LIBBPF_MAJOR_VERSION
else if (bpf_obj)
diff --git a/collectors/ebpf.plugin/ebpf_shm.h b/collectors/ebpf.plugin/ebpf_shm.h
index f0559e4312..8e118a6f58 100644
--- a/collectors/ebpf.plugin/ebpf_shm.h
+++ b/collectors/ebpf.plugin/ebpf_shm.h
@@ -56,7 +56,6 @@ extern netdata_publish_shm_t **shm_pid;
extern void *ebpf_shm_thread(void *ptr);
extern void ebpf_shm_create_apps_charts(struct ebpf_module *em, void *ptr);
-extern void clean_shm_pid_structures();
extern netdata_ebpf_targets_t shm_targets[];
extern struct config shm_config;
diff --git a/collectors/ebpf.plugin/ebpf_socket.c b/collectors/ebpf.plugin/ebpf_socket.c
index 7b2d4a5bfc..a32395df0a 100644
--- a/collectors/ebpf.plugin/ebpf_socket.c
+++ b/collectors/ebpf.plugin/ebpf_socket.c
@@ -2827,15 +2827,6 @@ static void clean_hostnames(ebpf_network_viewer_hostname_list_t *hostnames)
}
}
-void clean_socket_apps_structures() {
- struct pid_stat *pids = root_of_pids;
- while (pids) {
- freez(socket_bandwidth_curr[pids->pid]);
-
- pids = pids->next;
- }
-}
-
/**
* Cleanup publish syscall
*
@@ -2939,7 +2930,8 @@ static void ebpf_socket_cleanup(void *ptr)
bpf_link__destroy(probe_links[i]);
i++;
}
- bpf_object__close(objects);
+ if (objects)
+ bpf_object__close(objects);
}
finalized_threads = 1;
}
diff --git a/collectors/ebpf.plugin/ebpf_socket.h b/collectors/ebpf.plugin/ebpf_socket.h
index 672001301a..b0ef44006a 100644
--- a/collectors/ebpf.plugin/ebpf_socket.h
+++ b/collectors/ebpf.plugin/ebpf_socket.h
@@ -362,7 +362,6 @@ extern void update_listen_table(uint16_t value, uint16_t proto, netdata_passive_
extern void parse_network_viewer_section(struct config *cfg);
extern void fill_ip_list(ebpf_network_viewer_ip_list_t **out, ebpf_network_viewer_ip_list_t *in, char *table);
extern void parse_service_name_section(struct config *cfg);
-extern void clean_socket_apps_structures();
extern ebpf_socket_publish_apps_t **socket_bandwidth_curr;
extern struct config socket_config;
diff --git a/collectors/ebpf.plugin/ebpf_softirq.c b/collectors/ebpf.plugin/ebpf_softirq.c
index f5e79279f2..213ce05c6b 100644
--- a/collectors/ebpf.plugin/ebpf_softirq.c
+++ b/collectors/ebpf.plugin/ebpf_softirq.c
@@ -97,7 +97,8 @@ static void softirq_cleanup(void *ptr)
bpf_link__destroy(probe_links[i]);
i++;
}
- bpf_object__close(objects);
+ if (objects)
+ bpf_object__close(objects);
}
}
diff --git a/collectors/ebpf.plugin/ebpf_swap.c b/collectors/ebpf.plugin/ebpf_swap.c
index 7d84233580..3549e1ed1c 100644
--- a/collectors/ebpf.plugin/ebpf_swap.c
+++ b/collectors/ebpf.plugin/ebpf_swap.c
@@ -196,18 +196,6 @@ static inline int ebpf_swap_load_and_attach(struct swap_bpf *obj, ebpf_module_t
*****************************************************************/
/**
- * Clean swap structure
- */
-void clean_swap_pid_structures() {
- struct pid_stat *pids = root_of_pids;
- while (pids) {
- freez(swap_pid[pids->pid]);
-
- pids = pids->next;
- }
-}
-
-/**
* Clean up the main thread.
*
* @param ptr thread data.
@@ -238,7 +226,8 @@ static void ebpf_swap_cleanup(void *ptr)
bpf_link__destroy(probe_links[i]);
i++;
}
- bpf_object__close(objects);
+ if (objects)
+ bpf_object__close(objects);
}
#ifdef LIBBPF_MAJOR_VERSION
else if (bpf_obj)
diff --git a/collectors/ebpf.plugin/ebpf_swap.h b/collectors/ebpf.plugin/ebpf_swap.h
index 31bda16a22..80c2c8e946 100644
--- a/collectors/ebpf.plugin/ebpf_swap.h
+++ b/collectors/ebpf.plugin/ebpf_swap.h
@@ -46,7 +46,6 @@ extern netdata_publish_swap_t **swap_pid;
extern void *ebpf_swap_thread(void *ptr);
extern void ebpf_swap_create_apps_charts(struct ebpf_module *em, void *ptr);
-extern void clean_swap_pid_structures();
extern struct config swap_config;
extern netdata_ebpf_targets_t swap_targets[];
diff --git a/collectors/ebpf.plugin/ebpf_sync.c b/collectors/ebpf.plugin/ebpf_sync.c
index b45ec86c11..0dc2199957 100644
--- a/collectors/ebpf.plugin/ebpf_sync.c
+++ b/collectors/ebpf.plugin/ebpf_sync.c
@@ -459,7 +459,8 @@ void ebpf_sync_cleanup_objects()
bpf_link__destroy(w->probe_links[j]);
j++;
}
- bpf_object__close(w->objects);
+ if (w->objects)
+ bpf_object__close(w->objects);
}
#ifdef LIBBPF_MAJOR_VERSION
else if (w->sync_obj)
diff --git a/collectors/ebpf.plugin/ebpf_vfs.c b/collectors/ebpf.plugin/ebpf_vfs.c
index e14165fb70..dc728c7559 100644
--- a/collectors/ebpf.plugin/ebpf_vfs.c
+++ b/collectors/ebpf.plugin/ebpf_vfs.c
@@ -50,20 +50,6 @@ static int read_thread_closed = 1;
*****************************************************************/
/**
- * Clean PID structures
- *
- * Clean the allocated structures.
- */
-void clean_vfs_pid_structures() {
- struct pid_stat *pids = root_of_pids;
- while (pids) {
- freez(vfs_pid[pids->pid]);
-
- pids = pids->next;
- }
-}
-
-/**
* Clean up the main thread.
*
* @param ptr thread data.
@@ -92,7 +78,8 @@ static void ebpf_vfs_cleanup(void *ptr)
bpf_link__destroy(probe_links[i]);
i++;
}
- bpf_object__close(objects);
+ if (objects)
+ bpf_object__close(objects);
}
}
diff --git a/collectors/ebpf.plugin/ebpf_vfs.h b/collectors/ebpf.plugin/ebpf_vfs.h
index 67542ad44e..87a21e39c5 100644
--- a/collectors/ebpf.plugin/ebpf_vfs.h
+++ b/collectors/ebpf.plugin/ebpf_vfs.h
@@ -156,7 +156,6 @@ extern netdata_publish_vfs_t **vfs_pid;
extern void *ebpf_vfs_thread(void *ptr);
extern void ebpf_vfs_create_apps_charts(struct ebpf_module *em, void *ptr);
-extern void clean_vfs_pid_structures();
extern struct config vfs_config;