env_dpdk: delete all unnecessary files created by dpdk 18.05
DPDK 18.05 introduces a new "runtime" directory, which contains hugepage metadata to be accessed by secondary processes. There may be multiple files per each memseg and we cannot easily predict their count, so this patch deletes all regular files in that directory. $ ls -l /var/run/dpdk/spdk_pidX total 16784 -rw------- 1 root root 4096 Jul 27 15:10 fbarray_memseg-1048576k-1-0 -rw------- 1 root root 188416 Jul 27 15:10 fbarray_memzone -rw-r--r-- 1 root root 16974144 Jul 27 15:10 hugepage_data -rw-r--r-- 1 root root 12432 Jul 27 15:10 hugepage_info srwxr-xr-x 1 root root 0 Jul 27 15:10 mp_socket The DPDK config file is not located in this directory yet to preserve some of the backward compability. Eventually, it will moved there as well. Change-Id: I61cf1a47b306b51b0817c9d870841508f1e5e604 Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/420659 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
6d4e910f32
commit
b86c6b1704
@ -100,6 +100,10 @@ _sprintf_alloc(const char *format, ...)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if RTE_VERSION >= RTE_VERSION_NUM(18, 05, 0, 0)
|
||||||
|
const char *eal_get_runtime_dir(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_env_unlink_shared_files(void)
|
spdk_env_unlink_shared_files(void)
|
||||||
{
|
{
|
||||||
@ -110,10 +114,34 @@ spdk_env_unlink_shared_files(void)
|
|||||||
fprintf(stderr, "Unable to unlink shared memory file: %s. Error code: %d\n", buffer, errno);
|
fprintf(stderr, "Unable to unlink shared memory file: %s. Error code: %d\n", buffer, errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if RTE_VERSION < RTE_VERSION_NUM(18, 05, 0, 0)
|
||||||
snprintf(buffer, PATH_MAX, "/var/run/.spdk_pid%d_hugepage_info", getpid());
|
snprintf(buffer, PATH_MAX, "/var/run/.spdk_pid%d_hugepage_info", getpid());
|
||||||
if (unlink(buffer)) {
|
if (unlink(buffer)) {
|
||||||
fprintf(stderr, "Unable to unlink shared memory file: %s. Error code: %d\n", buffer, errno);
|
fprintf(stderr, "Unable to unlink shared memory file: %s. Error code: %d\n", buffer, errno);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
DIR *dir;
|
||||||
|
struct dirent *d;
|
||||||
|
|
||||||
|
dir = opendir(eal_get_runtime_dir());
|
||||||
|
if (!dir) {
|
||||||
|
fprintf(stderr, "Failed to open DPDK runtime dir: %s (%d)\n", eal_get_runtime_dir(), errno);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((d = readdir(dir)) != NULL) {
|
||||||
|
if (d->d_type != DT_REG) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(buffer, PATH_MAX, "%s/%s", eal_get_runtime_dir(), d->d_name);
|
||||||
|
if (unlink(buffer)) {
|
||||||
|
fprintf(stderr, "Unable to unlink shared memory file: %s. Error code: %d\n", buffer, errno);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closedir(dir);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user