From 9840ccada14f1c67b09323b5f4d96d2d7334a5cc Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Tue, 10 Apr 2018 11:00:50 -0400 Subject: Clean up temp dir in failure cases Change-Id: Icfb99a09726c01e96ff14967afbafa4116e02eff Signed-off-by: Dave Barach --- src/vppinfra/linux/mem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vppinfra/linux/mem.c b/src/vppinfra/linux/mem.c index 475e3dcd747..d479da3f0cb 100644 --- a/src/vppinfra/linux/mem.c +++ b/src/vppinfra/linux/mem.c @@ -127,6 +127,7 @@ clib_mem_vm_ext_alloc (clib_mem_vm_alloc_t * a) if (mount ("none", (char *) mount_dir, "hugetlbfs", 0, NULL)) { + rmdir ((char *) mount_dir); err = clib_error_return_unix (0, "mount hugetlb directory '%s'", mount_dir); goto error; @@ -136,6 +137,8 @@ clib_mem_vm_ext_alloc (clib_mem_vm_alloc_t * a) if ((fd = open ((char *) filename, O_CREAT | O_RDWR, 0755)) == -1) { + umount2 ((char *) mount_dir, MNT_DETACH); + rmdir ((char *) mount_dir); err = clib_error_return_unix (0, "open"); goto error; } -- cgit 1.2.3-korg