From a3557b4cc1a75cff36a2b42464be3363e881ee5c Mon Sep 17 00:00:00 2001 From: Carlos Tripiana Montes <tripiana@schedmd.com> Date: Thu, 15 Apr 2021 15:27:33 +0200 Subject: [PATCH] job_container/tmpfs: fix bug in fini not freeing all variables Now, if umount2 for basepath fails, it still frees everything up. In preparation for subsequent changes as well. Bug 11093 --- src/plugins/job_container/tmpfs/job_container_tmpfs.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/job_container/tmpfs/job_container_tmpfs.c b/src/plugins/job_container/tmpfs/job_container_tmpfs.c index f18f14a62a0..2680413a661 100644 --- a/src/plugins/job_container/tmpfs/job_container_tmpfs.c +++ b/src/plugins/job_container/tmpfs/job_container_tmpfs.c @@ -151,7 +151,7 @@ extern int init(void) */ extern int fini(void) { - int rc = 0; + int rc = SLURM_SUCCESS; debug("%s unloaded", plugin_name); @@ -164,11 +164,10 @@ extern int fini(void) error("%s: Configuration not loaded", __func__); return SLURM_ERROR; } - rc = umount2(jc_conf->basepath, MNT_DETACH); - if (rc) { + if (umount2(jc_conf->basepath, MNT_DETACH)) { error("%s: umount2: %s failed: %s", __func__, jc_conf->basepath, strerror(errno)); - return SLURM_ERROR; + rc = SLURM_ERROR; } free_jc_conf(); @@ -177,7 +176,7 @@ extern int fini(void) step_ns_fd = -1; } - return SLURM_SUCCESS; + return rc; } extern int container_p_restore(char *dir_name, bool recover) -- GitLab