From 036d9239724683017ee472d68a1aebef9fef90cf Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Thu, 20 Sep 2018 12:47:25 +0200 Subject: [PATCH] env/dpdk: do not clean up DPDK 18.05 shared files eal_get_runtime_dir() that we used so far is not available in DPDK shared libraries, so we remove its usages in SPDK together with the functionality of removing files left over by DPDK. Luckily for us, this only affects DPDK 18.05, as for DPDK 18.08+ the --no-shconf option that we use prevents all those files from being created whatsoever. Change-Id: I078fb7686d2445a6acb067b0c3762a9c99f9a429 Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/426218 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Lance Hartmann Reviewed-by: Seth Howell Reviewed-by: Paul Luse Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris --- lib/env_dpdk/init.c | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/lib/env_dpdk/init.c b/lib/env_dpdk/init.c index de6ac410d..a9ac91275 100644 --- a/lib/env_dpdk/init.c +++ b/lib/env_dpdk/init.c @@ -100,42 +100,20 @@ _sprintf_alloc(const char *format, ...) return NULL; } -#if RTE_VERSION >= RTE_VERSION_NUM(18, 05, 0, 0) -const char *eal_get_runtime_dir(void); -#endif - static void spdk_env_unlink_shared_files(void) { + /* Starting with DPDK 18.05, there are more files with unpredictable paths + * and filenames. The --no-shconf option prevents from creating them, but + * only for DPDK 18.08+. For DPDK 18.05 we just leave them be. + */ +#if RTE_VERSION < RTE_VERSION_NUM(18, 05, 0, 0) char buffer[PATH_MAX]; -#if RTE_VERSION < RTE_VERSION_NUM(18, 05, 0, 0) snprintf(buffer, PATH_MAX, "/var/run/.spdk_pid%d_hugepage_info", getpid()); if (unlink(buffer)) { 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 }